public class

OfBizClusterMessageStore

extends Object
java.lang.Object
   ↳ com.atlassian.jira.cluster.OfBizClusterMessageStore

Class Overview

Responsible for storing and retrieving cluster messages in the underlying database.

Summary

Constants
String CLAIMED_BY_NODE
String DESTINATION_NODE
String ENTITY
String ID
String MESSAGE
String MESSAGE_TIME
String SOURCE_NODE
Public Constructors
OfBizClusterMessageStore(OfBizDelegator ofBizDelegator)
Public Methods
ClusterMessage createMessage(String sourceNode, String destinationNode, String message)
Creates a ClusterMessage and stores it in the underlying database
int deleteMessage(ClusterMessage clusterMessage)
int deleteMessagesBefore(Date before)
Long getLatestMessageByNodeId(String nodeId)
Get the id of the latest message in the store for a node..
List<ClusterMessage> getMessages(Node sourceNode, Node destinationNode, Long afterMessageId)
Retrieves the messages destined for the given node, from a source node.
GenericValue storeMessage(ClusterMessage message)
Stores the message in the underlying database.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

protected static final String CLAIMED_BY_NODE

Constant Value: "claimedByNode"

protected static final String DESTINATION_NODE

Constant Value: "destinationNode"

protected static final String ENTITY

Constant Value: "ClusterMessage"

protected static final String ID

Constant Value: "id"

protected static final String MESSAGE

Constant Value: "message"

protected static final String MESSAGE_TIME

Constant Value: "messageTime"

protected static final String SOURCE_NODE

Constant Value: "sourceNode"

Public Constructors

public OfBizClusterMessageStore (OfBizDelegator ofBizDelegator)

Public Methods

public ClusterMessage createMessage (String sourceNode, String destinationNode, String message)

Creates a ClusterMessage and stores it in the underlying database

Parameters
sourceNode the ID of the source node (required)
destinationNode the ID of the destination node (required)
message the message to send (required)

public int deleteMessage (ClusterMessage clusterMessage)

public int deleteMessagesBefore (Date before)

public Long getLatestMessageByNodeId (String nodeId)

Get the id of the latest message in the store for a node.. That is the message with the highest id or null if there are no messages.

Parameters
nodeId the id of the node.
Returns
  • the id of the latest message in the store.

public List<ClusterMessage> getMessages (Node sourceNode, Node destinationNode, Long afterMessageId)

Retrieves the messages destined for the given node, from a source node. Returns messages with either the specific node id, or destined for all, but they must have been sent from another node - no listening to your own messages. We process each source node separately because the message Ids are not monotonically increasing across nodes.

Parameters
sourceNode The sending node
destinationNode The listening node
afterMessageId Only messages with a higher Message Id than this id will be returned. If starting beyond is null will return all messages for the source destinationNode pair.
Returns
  • a non-null list

public GenericValue storeMessage (ClusterMessage message)

Stores the message in the underlying database.

Parameters
message - the message to store in the underlying table