public class Message
extends java.lang.Object
implements java.util.Map<java.lang.String,java.lang.Object>, com.vordel.common.Dictionary
Circuit
This object maps property names to Objects.
MessageProcessor
s can inspect, add, and remove properties as they
perform their work. Co-operating MessageProcessors can share these properties,
once a type is agreed for them.
The MessageListener
interface can be used to listen to Message lifecycle events. A MessageListener can be
registered with a Message instance by listening first for a Message creation event via the
addCreationListener(MessageCreationListener)
then calling the
addMessageListener(MessageListener)
method on the Message parameter, e.g.
Message.addCreationListener(new MessageCreationListener() { public void messageCreated(Message m, Object source) { m.addMessageListener(new MessageListenerAdapter(){ public void preCircuitProcessing(Circuit initialContext, Message message, Object context) { System.out.println("Message about to be processed in circuits, id: "+message.correlationId); } }); } });Notification of completion of a message in the circuit can be monitored, to allow for cleanup of resources when the message is no longer useful.
MessageListener.onMessageCompletion(com.vordel.circuit.Message)
callbacks are called in the reverse order to that in which they
are registered.Modifier and Type | Field and Description |
---|---|
com.vordel.dwe.CorrelationID |
correlationId |
protected static java.util.List<MessageCreationListener> |
creationCallbacks |
long |
creationTime |
Constructor and Description |
---|
Message(com.vordel.dwe.CorrelationID correlationId,
java.lang.Object source)
Create a new message object.
|
Modifier and Type | Method and Description |
---|---|
static void |
addCreationListener(MessageCreationListener mcl)
When a new message is created, each MessageCreationListener is informed, so it
may decorate the message with its own private annotations.
|
void |
addMessageListener(MessageListener listener)
Add a listener to intercept this Message before and after filter and circuit invocations.
|
void |
addPropertiesListener(java.beans.PropertyChangeListener listener) |
void |
addPropertiesListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener) |
java.lang.String |
allocID() |
void |
clear() |
void |
complete()
Called once the message has been entirely processed and the client transaction complete.
|
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
static void |
deregisterMessageLocalStorage(int slot)
Deregister a message local slot.
|
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> |
entrySet() |
void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue) |
void |
forceGenerateAttributes() |
java.lang.Object |
get(java.lang.Object key) |
java.lang.Object |
get(java.lang.String key) |
com.vordel.dwe.CorrelationID |
getIDBase() |
int |
getLogMask() |
java.lang.Object |
getMessageLocalStorage(int slot)
Get the caller-specific Object previously set in the Message by
setMessageLocalStorage(int, java.lang.Object) . |
int |
getPayloadMask() |
com.vordel.circuit.log.LogMessagePayloadProcessor |
getPayloadProcessor() |
boolean |
isEmpty() |
java.util.Set<java.lang.String> |
keySet() |
void |
logPayload(Circuit c,
int maskItem,
MessageProcessor caller) |
java.util.Map<java.lang.String,java.lang.Object> |
pop() |
void |
push(java.util.Map<java.lang.String,java.lang.Object> map) |
java.lang.Object |
put(java.lang.String key,
java.lang.Object value) |
void |
putAll(java.util.Map<? extends java.lang.String,? extends java.lang.Object> m) |
java.lang.Object |
putGlobal(java.lang.String key,
java.lang.Object value) |
static void |
registerGenerator(java.lang.String property,
MessagePropertyGenerator generator) |
static int |
registerMessageLocalStorage()
Reserve a slot in each new Message instance in which to store an Object.
|
java.lang.Object |
remove(java.lang.Object key) |
java.lang.Object |
remove(java.lang.String key) |
static boolean |
removeCreationListener(MessageCreationListener mcl)
Remove the message creation listener
|
void |
removeMessageListener(MessageListener listener)
Remove all occurrences of a listener added in the corresponding
addMessageListener(com.vordel.circuit.MessageListener) method. |
void |
removePropertiesListener(java.beans.PropertyChangeListener listener) |
void |
removePropertiesListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener) |
void |
setLogMask(int logMask) |
void |
setMessageLocalStorage(int slot,
java.lang.Object o)
Set a caller-specific Object in a previously registered slot in the Message.
|
void |
setPayloadMask(int payloadMask) |
void |
setPayloadProcessor(com.vordel.circuit.log.LogMessagePayloadProcessor payloadProcessor) |
int |
size() |
void |
storeOpsField(com.vordel.vary.VariantObject object,
java.lang.String msgField,
com.vordel.vary.IntegerField opsDBField) |
void |
storeOpsField(com.vordel.vary.VariantObject object,
java.lang.String msgField,
com.vordel.vary.StringField opsDBField) |
java.util.Collection<java.lang.Object> |
values() |
public final com.vordel.dwe.CorrelationID correlationId
public final long creationTime
protected static final java.util.List<MessageCreationListener> creationCallbacks
public Message(com.vordel.dwe.CorrelationID correlationId, java.lang.Object source)
correlationId
: A unique id for this messagecreationTime
: The creation time of this messageMessageProperties.MESSAGE_RECEPTION_TIME
: The creationTime
available via the propertiesMessageCreationListener
s are informed of the
construction of this message, after the specified fields are initialized.public void push(java.util.Map<java.lang.String,java.lang.Object> map)
public java.util.Map<java.lang.String,java.lang.Object> pop()
public java.lang.Object put(java.lang.String key, java.lang.Object value)
put
in interface java.util.Map<java.lang.String,java.lang.Object>
public java.lang.Object putGlobal(java.lang.String key, java.lang.Object value)
public java.lang.Object get(java.lang.String key)
get
in interface com.vordel.common.Dictionary
public com.vordel.dwe.CorrelationID getIDBase()
public java.lang.String allocID()
public static final int registerMessageLocalStorage()
LoadableModule.load(com.vordel.dwe.LoadableModule, java.lang.String)
method, which may wish to reserve one slot for all instances of its
type to say track transport-specific information in each Message. Lookup of Message-local Objects is optimized as
it is a simple indexing into an internal array, and Objects stored in this way are isolated from the
MessageProperties.java.lang.RuntimeException
- if the 64 slot maximum is exceeded.getMessageLocalStorage(int)
,
setMessageLocalStorage(int, Object)
,
deregisterMessageLocalStorage(int)
public static final void deregisterMessageLocalStorage(int slot)
LoadableModule.unload()
method.slot
- The slot number to release. This slot becomes available to further
registerMessageLocalStorage()
calls. There is no guarantee that subsequent calls to
registerMessageLocalStorage()
by the same caller will result in the same slot being returned.public void setMessageLocalStorage(int slot, java.lang.Object o)
MessageListener
callback method, early on in the Message lifecycle.slot
- The slot in which to set the Object.o
- The Object.public java.lang.Object getMessageLocalStorage(int slot)
setMessageLocalStorage(int, java.lang.Object)
.slot
- The slot to lookup.public void complete()
TransportModule
when finished with the client transactions on this Message.public static final void addCreationListener(MessageCreationListener mcl)
public static final boolean removeCreationListener(MessageCreationListener mcl)
public final void addMessageListener(MessageListener listener)
listener
- The MessageListener
public final void removeMessageListener(MessageListener listener)
addMessageListener(com.vordel.circuit.MessageListener)
method.listener
- The MessageListener
public void setLogMask(int logMask)
public int getLogMask()
public void setPayloadMask(int payloadMask)
public int getPayloadMask()
public void setPayloadProcessor(com.vordel.circuit.log.LogMessagePayloadProcessor payloadProcessor)
public com.vordel.circuit.log.LogMessagePayloadProcessor getPayloadProcessor()
public final void addPropertiesListener(java.beans.PropertyChangeListener listener)
public final void addPropertiesListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
public final void removePropertiesListener(java.beans.PropertyChangeListener listener)
public final void removePropertiesListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
public void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
public java.lang.Object remove(java.lang.String key)
public static void registerGenerator(java.lang.String property, MessagePropertyGenerator generator)
public void forceGenerateAttributes()
public void logPayload(Circuit c, int maskItem, MessageProcessor caller)
public void storeOpsField(com.vordel.vary.VariantObject object, java.lang.String msgField, com.vordel.vary.StringField opsDBField)
public void storeOpsField(com.vordel.vary.VariantObject object, java.lang.String msgField, com.vordel.vary.IntegerField opsDBField)
public int size()
size
in interface java.util.Map<java.lang.String,java.lang.Object>
public boolean isEmpty()
isEmpty
in interface java.util.Map<java.lang.String,java.lang.Object>
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<java.lang.String,java.lang.Object>
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<java.lang.String,java.lang.Object>
public java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map<java.lang.String,java.lang.Object>
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map<java.lang.String,java.lang.Object>
public void putAll(java.util.Map<? extends java.lang.String,? extends java.lang.Object> m)
putAll
in interface java.util.Map<java.lang.String,java.lang.Object>
public void clear()
clear
in interface java.util.Map<java.lang.String,java.lang.Object>
public java.util.Set<java.lang.String> keySet()
keySet
in interface java.util.Map<java.lang.String,java.lang.Object>
public java.util.Collection<java.lang.Object> values()
values
in interface java.util.Map<java.lang.String,java.lang.Object>
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
entrySet
in interface java.util.Map<java.lang.String,java.lang.Object>
This documentation and all its contents and graphics, copyright © 1999 - 2011 Vordel