
Package ca.uhn.fhir.broker.jms
Class SpringMessagingReceiverAdapter<T>
java.lang.Object
ca.uhn.fhir.broker.jms.SpringMessagingReceiverAdapter<T>
- Type Parameters:
T
- the type of payload this message consumer is expecting to receive
- All Implemented Interfaces:
IChannelConsumer<T>
,AutoCloseable
Adapt a Spring Messaging (JMS) Queue to
IChannelConsumer
-
Constructor Summary
ConstructorsConstructorDescriptionSpringMessagingReceiverAdapter
(Class<? extends ca.uhn.fhir.rest.server.messaging.IMessage<T>> theMessageType, ISpringMessagingChannelReceiver theSpringMessagingChannelReceiver, IMessageListener<T> theMessageListener) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close this consumer's listener and this consumer, releasing any resources.boolean
isClosed()
void
pause()
Pause requesting new messages from the broker until resume() is called.void
resume()
Resume requesting messages from the broker.void
start()
Start the thread(s) that will be consuming messagesvoid
subscribe
(org.springframework.messaging.MessageHandler theMessageHandler) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ca.uhn.fhir.broker.api.IChannelConsumer
checkState
-
Constructor Details
-
SpringMessagingReceiverAdapter
public SpringMessagingReceiverAdapter(Class<? extends ca.uhn.fhir.rest.server.messaging.IMessage<T>> theMessageType, ISpringMessagingChannelReceiver theSpringMessagingChannelReceiver, IMessageListener<T> theMessageListener)
-
-
Method Details
-
subscribe
-
close
Description copied from interface:IChannelConsumer
Close this consumer's listener and this consumer, releasing any resources.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceIChannelConsumer<T>
-
isClosed
- Specified by:
isClosed
in interfaceIChannelConsumer<T>
- Returns:
- true if this consumer is closed
-
getChannelName
- Specified by:
getChannelName
in interfaceIChannelConsumer<T>
- Returns:
- the name of the topic or queue that this consumer is consuming from
-
start
Description copied from interface:IChannelConsumer
Start the thread(s) that will be consuming messages- Specified by:
start
in interfaceIChannelConsumer<T>
- Throws:
ChannelConsumerStartFailureException
- if the consumer fails to start (e.g. if it fails to connect to the broker)
-
getSpringMessagingChannelReceiver
-
getMessageType
- Specified by:
getMessageType
in interfaceIChannelConsumer<T>
- Returns:
- the type of messages that will be delivered to this consumer
-
getMessageListener
- Specified by:
getMessageListener
in interfaceIChannelConsumer<T>
- Returns:
- the
IMessageListener
this consumer is sending messages to (i.e. the one it was created with).
-
pause
Description copied from interface:IChannelConsumer
Pause requesting new messages from the broker until resume() is called.- Specified by:
pause
in interfaceIChannelConsumer<T>
-
resume
Description copied from interface:IChannelConsumer
Resume requesting messages from the broker.- Specified by:
resume
in interfaceIChannelConsumer<T>
-