public abstract class AbstractBasicMessageListener<T extends BasicMessage> extends Object implements javax.jms.MessageListener
AbstractBasicMessageListener(Class) or
determineBasicMessageClass() unless either (a) the subclass hierarchy has generic types that are specific
enough for reflection to determine the type of BasicMessage being listened for or (b) the message type being
listened for is BasicMessage and not one of its subclasses.| Modifier | Constructor and Description |
|---|---|
|
AbstractBasicMessageListener() |
protected |
AbstractBasicMessageListener(Class<T> jsonDecoderRing)
If a subclass knows the type and can give it to us, that will be the type used to decode JSON strings into that
message type.
|
protected |
AbstractBasicMessageListener(ClassLoader basicMessageClassLoader)
A special constructor to be used when the desarialization should be based on the class name supplied in
MessageProcessor.HEADER_BASIC_MESSAGE_CLASS string property of Message. |
| Modifier and Type | Method and Description |
|---|---|
protected String |
convertReceivedMessageClassNameToDesiredMessageClassName(String className)
This allows subclasses to name a different JSON POJO implementation to use when deserializing
incoming JSON.
|
protected Class<T> |
determineBasicMessageClass()
In order to decode the JSON, we need the class representation of the basic message type.
|
protected Class<T> |
getBasicMessageClass() |
ConsumerConnectionContext |
getConsumerConnectionContext()
When this listener is attached to a consumer, this field should be filled in to allow the listener to perform
other tasks it needs which might require access to the context.
|
protected org.jboss.logging.Logger |
getLog() |
protected BasicMessageWithExtraData<T> |
parseMessage(javax.jms.Message message)
Given the BasicMessage received over the wire, convert it to our T representation of the message and keep any
extra data that came with it.
|
void |
setConsumerConnectionContext(ConsumerConnectionContext consumerConnectionContext) |
public AbstractBasicMessageListener()
protected AbstractBasicMessageListener(Class<T> jsonDecoderRing)
determineBasicMessageClass() unless BasicMessage is the message type that subclass wants to
explicitly use (as opposed to a subclass of BasicMessage).jsonDecoderRing - the class representation of the generic type Tprotected AbstractBasicMessageListener(ClassLoader basicMessageClassLoader)
MessageProcessor.HEADER_BASIC_MESSAGE_CLASS string property of Message. The given
basicMessageClassLoader should be able to resolve all types of messages the present listener can
encounter.basicMessageClassLoader - the ClassLoader to resolve the class supplied in
MessageProcessor.HEADER_BASIC_MESSAGE_CLASS string property of Messagepublic ConsumerConnectionContext getConsumerConnectionContext()
null if not associated with a
consumer yetpublic void setConsumerConnectionContext(ConsumerConnectionContext consumerConnectionContext)
protected BasicMessageWithExtraData<T> parseMessage(javax.jms.Message message)
The class T is determined as follows: First, the property MessageProcessor.HEADER_BASIC_MESSAGE_CLASS is
looked up in the given message's properties if there is a class name set and if
basicMessageClassLoader is not null, the class is gotten using
Class.forName(className, true, basicMessageClassLoader) (may throw an unchecked
ClassNotFoundException), otherwise getBasicMessageClass() is used to get the Java type to
deserialize to.
message - the over-the-wire messageprotected Class<T> determineBasicMessageClass()
AbstractBasicMessageListener(Class) to tell this object what the class of T
is.protected String convertReceivedMessageClassNameToDesiredMessageClassName(String className)
className - the received JSON can be handled by this classprotected org.jboss.logging.Logger getLog()
Copyright © 2015–2016 Red Hat, Inc.. All rights reserved.