public class MessageProcessor extends Object
ConnectionContextFactory to create contexts (which create destinations, sessions, and connections for
you) that you then use to pass to the listen and send methods in this class.| Constructor and Description |
|---|
MessageProcessor() |
| Modifier and Type | Method and Description |
|---|---|
protected javax.jms.Message |
createMessage(ConnectionContext context,
BasicMessage basicMessage)
Same as
createMessage(ConnectionContext, BasicMessage, Map) with null headers. |
protected javax.jms.Message |
createMessage(ConnectionContext context,
BasicMessage basicMessage,
Map<String,String> headers)
Creates a text message that can be send via a producer that contains the given BasicMessage's JSON encoded data.
|
protected javax.jms.Message |
createMessageWithBinaryData(ConnectionContext context,
BasicMessage basicMessage,
InputStream inputStream)
Same as
createMessage(ConnectionContext, BasicMessage, Map) with null headers. |
protected javax.jms.Message |
createMessageWithBinaryData(ConnectionContext context,
BasicMessage basicMessage,
InputStream inputStream,
Map<String,String> headers)
Creates a blob message that can be send via a producer that contains the given BasicMessage's JSON encoded data
along with binary data.
|
protected org.apache.activemq.ActiveMQSession |
getActiveMQSession(javax.jms.Session session) |
<T extends BasicMessage> |
listen(ConsumerConnectionContext context,
AbstractBasicMessageListener<T> listener)
Listens for messages.
|
MessageId |
send(ProducerConnectionContext context,
BasicMessage basicMessage)
Same as
send(ProducerConnectionContext, BasicMessage, Map) with null headers. |
MessageId |
send(ProducerConnectionContext context,
BasicMessage basicMessage,
Map<String,String> headers)
Send the given message to its destinations across the message bus.
|
<T extends BasicMessage> |
sendAndListen(ProducerConnectionContext context,
BasicMessage basicMessage,
BasicMessageListener<T> responseListener)
Same as
sendAndListen(ProducerConnectionContext, BasicMessage, BasicMessageListener, Map) with
null headers. |
<T extends BasicMessage> |
sendAndListen(ProducerConnectionContext context,
BasicMessage basicMessage,
BasicMessageListener<T> responseListener,
Map<String,String> headers)
Send the given message to its destinations across the message bus and any response sent back will be passed to
the given listener.
|
<R extends BasicMessage> |
sendRPC(ProducerConnectionContext context,
BasicMessage basicMessage,
Class<R> expectedResponseMessageClass)
Same as
sendRPC(ProducerConnectionContext, BasicMessage, Class, Map) with null headers. |
<R extends BasicMessage> |
sendRPC(ProducerConnectionContext context,
BasicMessage basicMessage,
Class<R> expectedResponseMessageClass,
Map<String,String> headers)
Send the given message to its destinations across the message bus and returns a Future to allow the caller to
retrieve the response.
|
MessageId |
sendWithBinaryData(ProducerConnectionContext context,
BasicMessage basicMessage,
File file)
Same as
sendWithBinaryData(ProducerConnectionContext, BasicMessage, File, Map)
with null headers. |
MessageId |
sendWithBinaryData(ProducerConnectionContext context,
BasicMessage basicMessage,
File file,
Map<String,String> headers)
Same as
sendWithBinaryData(ProducerConnectionContext, BasicMessage, InputStream, Map)
with the input stream being a stream to read the file. |
MessageId |
sendWithBinaryData(ProducerConnectionContext context,
BasicMessage basicMessage,
InputStream inputStream)
Same as
sendWithBinaryData(ProducerConnectionContext, BasicMessage, InputStream, Map)
with null headers. |
MessageId |
sendWithBinaryData(ProducerConnectionContext context,
BasicMessage basicMessage,
InputStream inputStream,
Map<String,String> headers)
Send the given message along with the stream of binary data to its destinations across the message bus.
|
public <T extends BasicMessage> void listen(ConsumerConnectionContext context, AbstractBasicMessageListener<T> listener) throws javax.jms.JMSException
context - information that determines where to listenlistener - the listener that processes the incoming messagesjavax.jms.JMSException - any errorConnectionContextFactory.createConsumerConnectionContext(Endpoint)public MessageId send(ProducerConnectionContext context, BasicMessage basicMessage) throws javax.jms.JMSException
send(ProducerConnectionContext, BasicMessage, Map) with null headers.javax.jms.JMSExceptionpublic MessageId send(ProducerConnectionContext context, BasicMessage basicMessage, Map<String,String> headers) throws javax.jms.JMSException
context - information that determines where the message is sentbasicMessage - the message to send with optional headers includedheaders - headers for the JMS transport that will override same-named headers in the basic messagejavax.jms.JMSException - any errorConnectionContextFactory.createProducerConnectionContext(Endpoint)public MessageId sendWithBinaryData(ProducerConnectionContext context, BasicMessage basicMessage, InputStream inputStream) throws javax.jms.JMSException
sendWithBinaryData(ProducerConnectionContext, BasicMessage, InputStream, Map)
with null headers.javax.jms.JMSExceptionpublic MessageId sendWithBinaryData(ProducerConnectionContext context, BasicMessage basicMessage, File file) throws javax.jms.JMSException, FileNotFoundException
sendWithBinaryData(ProducerConnectionContext, BasicMessage, File, Map)
with null headers.FileNotFoundException - if the file does not existjavax.jms.JMSExceptionpublic MessageId sendWithBinaryData(ProducerConnectionContext context, BasicMessage basicMessage, File file, Map<String,String> headers) throws javax.jms.JMSException, FileNotFoundException
sendWithBinaryData(ProducerConnectionContext, BasicMessage, InputStream, Map)
with the input stream being a stream to read the file.FileNotFoundException - if the file does not existjavax.jms.JMSExceptionpublic MessageId sendWithBinaryData(ProducerConnectionContext context, BasicMessage basicMessage, InputStream inputStream, Map<String,String> headers) throws javax.jms.JMSException
context - information that determines where the message is sentbasicMessage - the message to send with optional headers includedinputStream - binary data that will be sent with the messageheaders - headers for the JMS transport that will override same-named headers in the basic messagejavax.jms.JMSException - any errorConnectionContextFactory.createProducerConnectionContext(Endpoint)public <T extends BasicMessage> RPCConnectionContext sendAndListen(ProducerConnectionContext context, BasicMessage basicMessage, BasicMessageListener<T> responseListener) throws javax.jms.JMSException
sendAndListen(ProducerConnectionContext, BasicMessage, BasicMessageListener, Map) with
null headers.javax.jms.JMSExceptionpublic <T extends BasicMessage> RPCConnectionContext sendAndListen(ProducerConnectionContext context, BasicMessage basicMessage, BasicMessageListener<T> responseListener, Map<String,String> headers) throws javax.jms.JMSException
sendRPC(org.hawkular.bus.common.producer.ProducerConnectionContext, org.hawkular.bus.common.BasicMessage, java.lang.Class<R>) and use its returned
Future to wait for the response, rather than having to supply your own response listener.context - information that determines where the message is sentbasicMessage - the request message to send with optional headers includedresponseListener - The listener that will process the response of the request. This listener should close
its associated consumer when appropriate.headers - headers for the JMS transport that will override same-named headers in the basic messagejavax.jms.JMSException - any errorConnectionContextFactory.createProducerConnectionContext(Endpoint)public <R extends BasicMessage> com.google.common.util.concurrent.ListenableFuture<BasicMessageWithExtraData<R>> sendRPC(ProducerConnectionContext context, BasicMessage basicMessage, Class<R> expectedResponseMessageClass) throws javax.jms.JMSException
sendRPC(ProducerConnectionContext, BasicMessage, Class, Map) with null headers.javax.jms.JMSExceptionpublic <R extends BasicMessage> com.google.common.util.concurrent.ListenableFuture<BasicMessageWithExtraData<R>> sendRPC(ProducerConnectionContext context, BasicMessage basicMessage, Class<R> expectedResponseMessageClass, Map<String,String> headers) throws javax.jms.JMSException
context - information that determines where the message is sentbasicMessage - the request message to send with optional headers includedexpectedResponseMessageClass - this is the message class of the expected response object.headers - headers for the JMS transport that will override same-named headers in the basic messagejavax.jms.JMSException - any errorConnectionContextFactory.createProducerConnectionContext(Endpoint)protected javax.jms.Message createMessage(ConnectionContext context, BasicMessage basicMessage) throws javax.jms.JMSException
createMessage(ConnectionContext, BasicMessage, Map) with null headers.javax.jms.JMSExceptionprotected javax.jms.Message createMessage(ConnectionContext context, BasicMessage basicMessage, Map<String,String> headers) throws javax.jms.JMSException
context - the context whose session is used to create the messagebasicMessage - contains the data that will be JSON-encoded and encapsulated in the created message, with
optional headers includedheaders - headers for the Message that will override same-named headers in the basic messagejavax.jms.JMSException - any errorNullPointerException - if the context is null or the context's session is nullprotected javax.jms.Message createMessageWithBinaryData(ConnectionContext context, BasicMessage basicMessage, InputStream inputStream) throws javax.jms.JMSException
createMessage(ConnectionContext, BasicMessage, Map) with null headers.javax.jms.JMSExceptionprotected javax.jms.Message createMessageWithBinaryData(ConnectionContext context, BasicMessage basicMessage, InputStream inputStream, Map<String,String> headers) throws javax.jms.JMSException
context - the context whose session is used to create the messagebasicMessage - contains the data that will be JSON-encoded and encapsulated in the created message, with
optional headers includedinputStream - binary data that will be sent with the messageheaders - headers for the Message that will override same-named headers in the basic messagejavax.jms.JMSException - any errorNullPointerException - if the context is null or the context's session is nullprotected org.apache.activemq.ActiveMQSession getActiveMQSession(javax.jms.Session session)
Copyright © 2015 Red Hat, Inc.. All rights reserved.