public class JMSConnectionMockupMQ extends JMSConnection
Modifier and Type | Class and Description |
---|---|
protected static class |
JMSConnectionMockupMQ.CallOnMessageThread |
protected static class |
JMSConnectionMockupMQ.TestConnection |
protected static class |
JMSConnectionMockupMQ.TestConnectionFactory |
protected static class |
JMSConnectionMockupMQ.TestDestination |
protected static class |
JMSConnectionMockupMQ.TestMessageConsumer |
protected static class |
JMSConnectionMockupMQ.TestMessageProducer |
static class |
JMSConnectionMockupMQ.TestObjectMessage |
protected static class |
JMSConnectionMockupMQ.TestQueue |
class |
JMSConnectionMockupMQ.TestQueueBrowser |
class |
JMSConnectionMockupMQ.TestQueueReceiver |
class |
JMSConnectionMockupMQ.TestQueueSession |
protected static class |
JMSConnectionMockupMQ.TestSession |
protected static class |
JMSConnectionMockupMQ.TestTopic |
Modifier and Type | Field and Description |
---|---|
protected Set<Thread> |
concurrentTasksToComplete
A set of threads where onMessage has been called.
|
protected Map<String,JMSConnectionMockupMQ.TestDestination> |
destinations
A map from channelnames to destinations.
|
closeHook, connection, connectionLock, CONSUMER_KEY_SEPARATOR, consumers, instance, listeners, producers, session
Modifier | Constructor and Description |
---|---|
protected |
JMSConnectionMockupMQ()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Clean up singleton instance and internal state
|
static void |
clearTestQueues() |
protected javax.jms.ConnectionFactory |
getConnectionFactory()
Should be implemented according to a specific JMS broker.
|
protected javax.jms.Destination |
getDestination(String channelName)
Should be implemented according to a specific JMS broker.
|
static JMSConnection |
getInstance()
Get the singleton, and initialise it if it is new.
|
List<javax.jms.MessageListener> |
getListeners(ChannelID channel)
Returns a list of all MessageListeners listening to a particular channel
|
static javax.jms.ObjectMessage |
getObjectMessage(NetarkivetMessage nMsg)
Wrap a NetarkivetMessage into an ObjectMessage
|
javax.jms.QueueSession |
getQueueSession()
Provides a QueueSession instance.
|
protected void |
initConnection()
Initializes the JMS connection.
|
boolean |
isSentToChannel(TestChecksumJob job,
ChannelID channelID) |
void |
onException(javax.jms.JMSException e)
Does nothing.
|
static void |
updateMsgID(NetarkivetMessage msg,
String id)
For testing purposes: Set the ID of a message
|
static void |
useJMSConnectionMockupMQ() |
void |
waitForConcurrentTasksToFinish()
Waits until all threads where onMessage has been called have finished executing.
|
createQueueBrowser, getConsumerKey, reconnect, removeListener, reply, resend, send, sendMessage, setListener, unpack
protected final Set<Thread> concurrentTasksToComplete
protected Map<String,JMSConnectionMockupMQ.TestDestination> destinations
protected JMSConnectionMockupMQ()
public static JMSConnection getInstance()
protected void initConnection()
JMSConnection
initConnection
in class JMSConnection
protected javax.jms.ConnectionFactory getConnectionFactory() throws javax.jms.JMSException
JMSConnection
getConnectionFactory
in class JMSConnection
javax.jms.JMSException
- If unable to get QueueConnectionFactoryprotected javax.jms.Destination getDestination(String channelName) throws javax.jms.JMSException
JMSConnection
getDestination
in class JMSConnection
channelName
- the name of the wanted QueueChannels.isTopic(String)
javax.jms.JMSException
- If unable to get a destination.public void onException(javax.jms.JMSException e)
onException
in interface javax.jms.ExceptionListener
onException
in class JMSConnection
e
- The exception to ignore :-)public void cleanup()
cleanup
in interface CleanupIF
cleanup
in class JMSConnection
public void waitForConcurrentTasksToFinish()
public static javax.jms.ObjectMessage getObjectMessage(NetarkivetMessage nMsg)
nMsg
- a NetarkivetMessagepublic static void clearTestQueues()
public static void updateMsgID(NetarkivetMessage msg, String id)
msg
- The message to set the id onid
- the new idpublic static void useJMSConnectionMockupMQ()
public List<javax.jms.MessageListener> getListeners(ChannelID channel)
channel
- The channelpublic boolean isSentToChannel(TestChecksumJob job, ChannelID channelID)
public javax.jms.QueueSession getQueueSession() throws javax.jms.JMSException
JMSConnection
QueueSession
object isen't
available on the generic JMSConnectionFactory
getQueueSession
in class JMSConnection
QueueSession
object connected to the current JMS brokerjavax.jms.JMSException
- Failure to retrieve the QueueBrowser
JMS BrowserCopyright © 2005–2016 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.