Class ClusterMessageXStreamReceiver
java.lang.Object
com.atlassian.bamboo.cluster.clustermessage.ClusterMessageXStreamReceiver
- All Implemented Interfaces:
ClusterMessageReceiver
Receives a raw message from the cluster, deserializes it, and sends it locally via the
EventPublisher
.
To finally consume the event, all you need is an EventListener
that will capture it.
As a result, a single EventListener
is enough to consume the events sent
from both the local node and other cluster nodes.-
Constructor Summary
ConstructorDescriptionClusterMessageXStreamReceiver
(@NotNull XStreamManager xStreamManager, @NotNull com.atlassian.event.api.EventPublisher eventPublisher) -
Method Summary
Modifier and TypeMethodDescription<T extends ClusterMessage>
voidReceives a raw message.protected void
setLastLogTime
(long lastLogTime)
-
Constructor Details
-
ClusterMessageXStreamReceiver
@Inject public ClusterMessageXStreamReceiver(@NotNull @NotNull XStreamManager xStreamManager, @NotNull @NotNull com.atlassian.event.api.EventPublisher eventPublisher)
-
-
Method Details
-
receive
public <T extends ClusterMessage> void receive(@Nullable @Nullable String rawMessage, @Nullable @Nullable String senderNodeId) Description copied from interface:ClusterMessageReceiver
Receives a raw message. Implementations of this method are responsible for deserializing the raw message and handling the deserialized message appropriately.- Specified by:
receive
in interfaceClusterMessageReceiver
- Type Parameters:
T
- the type of the deserialized message, which must extend ClusterMessage- Parameters:
rawMessage
- the raw message received, can be nullsenderNodeId
- the node id of the node we received the message from
-
setLastLogTime
protected void setLastLogTime(long lastLogTime)
-