|
|||||||||
Atavism Version 2018.1 | AGIS API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectatavism.msgsys.MessageTrigger
public abstract class MessageTrigger
Run code on publisher when message matches our subscription. Sub-class to implement your own behavior.
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 Summary | |
---|---|
MessageTrigger()
No-arg constructor required for marshalling. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MessageTrigger()
Method Detail |
---|
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.
|
Copyright © 2018 Dragonsan Studios Sp. z o.o. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |