public abstract class MessageTrigger
extends java.lang.Object
Message triggers are associated with a specific subscription. The
trigger is instantiated (via marshalling) on each publisher. When
the publisher sends a message matching the subscription, the
subscription's trigger is run. First, match(atavism.msgsys.Message)
is called
to determine if the trigger should be run. If match() returns
true, then trigger()
is run with the message
and matching filter.
Sub-classes should use Java keyword "transient" for data members that should not be copied from subscriber to publisher.
Constructor and Description |
---|
MessageTrigger()
No-arg constructor required for marshalling.
|
Modifier and Type | Method and Description |
---|---|
boolean |
match(Message message)
True if the trigger should be run for this message.
|
abstract void |
setFilter(IFilter filter)
Set the trigger's filter.
|
abstract void |
trigger(Message message,
IFilter filter,
MessageAgent agent)
Called when message matches the filter.
|
public MessageTrigger()
public abstract void setFilter(IFilter filter)
public boolean match(Message message)
trigger(atavism.msgsys.Message, atavism.msgsys.IFilter, atavism.msgsys.MessageAgent)
.public abstract void trigger(Message message, IFilter filter, MessageAgent agent)
message
, but the trigger must not
"re-send" the message; do not use message
in calls
to MessageAgent.sendBroadcast()
and similar calls. It is OK to modify filter
. The
message is not re-matched if the message or filter are modified.
Use great care when designing MessageTriggers.
message
- The matched message.filter
- The matched filter, the same as passed to
setFilter()
.agent
- The local message agent.