com.mockrunner.mock.jms
Class MockMessageConsumer
java.lang.Object
com.mockrunner.mock.jms.MockMessageConsumer
- All Implemented Interfaces:
- java.io.Serializable, javax.jms.MessageConsumer
- Direct Known Subclasses:
- MockQueueReceiver, MockTopicSubscriber
public abstract class MockMessageConsumer
- extends java.lang.Object
- implements javax.jms.MessageConsumer, java.io.Serializable
Mock implementation of JMS MessageConsumer
.
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.jms.MessageConsumer |
receive |
MockMessageConsumer
public MockMessageConsumer(MockConnection connection,
java.lang.String messageSelector)
isClosed
public boolean isClosed()
- Returns if this consumer was closed.
- Returns:
true
if this consumer is closed
canConsume
public boolean canConsume(javax.jms.Message message)
- Returns if this consumer can consume an incoming message,
i.e. if a
MessageListener
is registered,
the receiver isn't closed and has an approriate selector.
- Returns:
true
if this receiver can consume the message
receiveMessage
public void receiveMessage(javax.jms.Message message)
- Adds a message that is immediately propagated to the
message listener. If there's no message listener,
nothing happens.
- Parameters:
message
- the message
getMessageSelector
public java.lang.String getMessageSelector()
throws javax.jms.JMSException
- Specified by:
getMessageSelector
in interface javax.jms.MessageConsumer
- Throws:
javax.jms.JMSException
getMessageListener
public javax.jms.MessageListener getMessageListener()
throws javax.jms.JMSException
- Specified by:
getMessageListener
in interface javax.jms.MessageConsumer
- Throws:
javax.jms.JMSException
setMessageListener
public void setMessageListener(javax.jms.MessageListener messageListener)
throws javax.jms.JMSException
- Specified by:
setMessageListener
in interface javax.jms.MessageConsumer
- Throws:
javax.jms.JMSException
receive
public javax.jms.Message receive(long timeout)
throws javax.jms.JMSException
- Specified by:
receive
in interface javax.jms.MessageConsumer
- Throws:
javax.jms.JMSException
receiveNoWait
public javax.jms.Message receiveNoWait()
throws javax.jms.JMSException
- Specified by:
receiveNoWait
in interface javax.jms.MessageConsumer
- Throws:
javax.jms.JMSException
close
public void close()
throws javax.jms.JMSException
- Specified by:
close
in interface javax.jms.MessageConsumer
- Throws:
javax.jms.JMSException
getMessageFilter
protected org.activemq.filter.mockrunner.Filter getMessageFilter()
getConnection
protected MockConnection getConnection()