OSMQ
v2.0.1

osmq.messages
Interface MessageAttributes

All Superinterfaces:
Immutable, KeyedData, java.io.Serializable
All Known Subinterfaces:
DataSetMessage, Message
All Known Implementing Classes:
DataSetMessageBean, MessageBean, MessageHeader

public interface MessageAttributes
extends KeyedData, Immutable

A multi-element data set (record) that includes identifying attributes such as a topic, action, data key, and correlation ID. Application data elements are referenced positionally, using an API similar to that empolyed by JDBC. An element can be put or retrieved as a String, int, double, long or char. The first element is reference as position 1, and the last as position n.


Field Summary
static int CONTENT_FORMAT
           
static int CORRELATION_ID
           
static int DATA_KEY
           
static int ORIGINATOR
           
static int RECIPIENT
           
static int SEND_TIMESTAMP
           
static int SENDER_SEQ
           
static int TOPIC
           
static int TOTAL_ATTRIBUTES
           
static char TRANS_ADD
           
static char TRANS_DELETE
           
static char TRANS_UPDATE
           
static int TRANSACTION
           
static int TYPE
           
 
Method Summary
 java.lang.Object clone()
           
 long getCorrelationNumber()
          Gets the message attribute used to identify a group of related transactions.
 java.lang.String getCorrelationString()
           
 char getFormat()
          Identifies the body format as either dataset, text or binary.
 java.lang.String getKey()
          Returns the unique identifier for the data contained in the message.
 int getKeyAsInt()
           
 java.lang.String getOriginator()
          Returns the identifier of the message sender (publisher).
 java.lang.String getRecipient()
          Returns the identifier of the message recipient, or null if the message is intended for all subscriber to the message topic.
 long getSequenceNumber()
          Returns the relative sequence number of this message.
 long getTimeStamp()
          Returns a timestamp indicating when the message was sent.
 java.lang.String getTopic()
          Returns the topic of the message.
 java.lang.String getTransaction()
          Returns the identifier of the event or activity that caused the transaction to be generated.
 char getTransactionAsChar()
          Returns the first character of the transaction identifer, or a null character if there is no transaction identifer.
 char getType()
          Identifies whether the message type is a MessageType.NOTIFICATION or MessageType.REQUEST .
 boolean hasAssignedCorrelationNumber()
          Determines if there is a correlation identifier value.
 boolean hasAssignedKey()
          Determines if there is a key value identifier.
 boolean hasAssignedOriginator()
          Determines whether a position has a value (versus null)
 boolean hasAssignedRecipient()
          Determine if there is a recipient identifier value.
 boolean hasAssignedTopic()
          Determines if there is a topic identifier value.
 void setCorrelationNumber(long n)
           
 void setCorrelationString(java.lang.String s)
           
 void setFormat(char t)
          Sets the attributes that identifies the type of data contained in the message body.
 void setKey(java.lang.String s)
           
 void setKeyAsInt(int n)
           
 void setOriginator(java.lang.String t)
          Sets the identifier of the message sender/originator.
 void setRecipient(java.lang.String t)
          Sets the unique recipient that will receive the message.
 void setSequenceNumber(long n)
          Sets the sequence number for this message.
 void setTimeStamp(long n)
          Sets the time the message was publisherd.
 void setTopic(java.lang.String topic)
           
 void setTransaction(java.lang.String e)
           
 void setTransactionAsChar(char c)
           
 void setType(char t)
          Sets the message type.
 
Methods inherited from interface osmq.util.Immutable
isImmutable, setImmutable
 

Field Detail

TOTAL_ATTRIBUTES

public static final int TOTAL_ATTRIBUTES
See Also:
Constant Field Values

RECIPIENT

public static final int RECIPIENT
See Also:
Constant Field Values

TOPIC

public static final int TOPIC
See Also:
Constant Field Values

TYPE

public static final int TYPE
See Also:
Constant Field Values

ORIGINATOR

public static final int ORIGINATOR
See Also:
Constant Field Values

CONTENT_FORMAT

public static final int CONTENT_FORMAT
See Also:
Constant Field Values

DATA_KEY

public static final int DATA_KEY
See Also:
Constant Field Values

TRANSACTION

public static final int TRANSACTION
See Also:
Constant Field Values

CORRELATION_ID

public static final int CORRELATION_ID
See Also:
Constant Field Values

SEND_TIMESTAMP

public static final int SEND_TIMESTAMP
See Also:
Constant Field Values

SENDER_SEQ

public static final int SENDER_SEQ
See Also:
Constant Field Values

TRANS_ADD

public static final char TRANS_ADD
See Also:
Constant Field Values

TRANS_DELETE

public static final char TRANS_DELETE
See Also:
Constant Field Values

TRANS_UPDATE

public static final char TRANS_UPDATE
See Also:
Constant Field Values
Method Detail

getTopic

public java.lang.String getTopic()
Returns the topic of the message.

Returns:
A string containing the topic. The topic defines the message contents for a subscriber (number of elements and the data type of each element).

setTopic

public void setTopic(java.lang.String topic)

getKey

public java.lang.String getKey()
Returns the unique identifier for the data contained in the message. (This "key" is relative to the the topic.)

Specified by:
getKey in interface KeyedData
Returns:
A string containing the unique identifier.

setKey

public void setKey(java.lang.String s)

setKeyAsInt

public void setKeyAsInt(int n)

getKeyAsInt

public int getKeyAsInt()

getTransaction

public java.lang.String getTransaction()
Returns the identifier of the event or activity that caused the transaction to be generated. This is a value that is based on the topic.

Standard events used for down-stream subscribers that maintain databases are TRANS_ADD, TRANS_DELETE, and TRANS_UPDATE.

Returns:
A string containing the transaction event.

getTransactionAsChar

public char getTransactionAsChar()
Returns the first character of the transaction identifer, or a null character if there is no transaction identifer.

Returns:
A char containing the transaction event.

setTransaction

public void setTransaction(java.lang.String e)

setTransactionAsChar

public void setTransactionAsChar(char c)

getCorrelationNumber

public long getCorrelationNumber()
Gets the message attribute used to identify a group of related transactions. The relationship is likely a unit-of-work that resulted in tranaction-related topics being generated. This is an optional header attribute.

Returns:
An int containing the correlation identifier.

setCorrelationNumber

public void setCorrelationNumber(long n)

getCorrelationString

public java.lang.String getCorrelationString()

setCorrelationString

public void setCorrelationString(java.lang.String s)

getOriginator

public java.lang.String getOriginator()
Returns the identifier of the message sender (publisher). The sender identifies a unique client process (instance).

Returns:
A string containing the message sender.

setOriginator

public void setOriginator(java.lang.String t)
Sets the identifier of the message sender/originator. Setting the originator should be performed when a message is published, and this value defaults to the client identifier used to attach to the message server.

NOTE This method should not be called by an application, since the value will be overridden by the message publisher adapter.


getRecipient

public java.lang.String getRecipient()
Returns the identifier of the message recipient, or null if the message is intended for all subscriber to the message topic.

Returns:
A string containing the recipient identifier.

setRecipient

public void setRecipient(java.lang.String t)
Sets the unique recipient that will receive the message. If a recipient value is set, only that recipient will receive the message. (Point-to-point messaging). Setting the recipient should be reserved for clients requesting a service (event type of MessageType.REQUEST) and for OLTP systems that receive a request that is being rejected. In the latter case, the OLTP system would send a point-to-point rejection message to the originator of the request.


getType

public char getType()
Identifies whether the message type is a MessageType.NOTIFICATION or MessageType.REQUEST .

Returns:
A char containing the event type value.
See Also:
setType(char)

setType

public void setType(char t)
Sets the message type. The message type is the category of event that caused a message to be generated. Standard type include MessageType.NOTIFICATION ('N') and MessageType.REQUEST ('R'), MessageType.DENIAL ('D'), MessageType.TOPIC_CHG ('T') and MessageType.BATCH_CONTROL ('B').

TYPE_NOTIFICATION messages are published by OLTP systems after it commits a transaction. (Batch applications can also publisher MessageType.NOTIFICATION messages.)

TYPE_REQUEST messages are point-to-point routed client requests for service. (Point-to-point messages are sent to a single recipient, and have the recipient identified in the message header, verus publish-subscribe messages that have no recipeint and are published to all subscribers to the message topic.)

MessageType.DENIAL messages are a point-to-point messages, routed to the originator by the service provider. They indicate a request for service has been denied.

MessageType.TOPIC_CHG messages are used internally to identify a TOPIC CHANGE EVENT.

MessageType.BATCH_CONTROL message are sent immediately before and after a batch of related messages. They are used to delimit the batch, so that subscribers can determine an action to be taken (such as creating export files, or updating database tables). The terminating CONTROL message will normally contain totals that should be considered a checksum.

See Also:
setRecipient(String t)

setTimeStamp

public void setTimeStamp(long n)
Sets the time the message was publisherd. This function is called by the message publisher after client submits the message for delivery.

NOTE This value should be set by the underlying client middleware, and not the application.

Parameters:
n - the time as a long.

setSequenceNumber

public void setSequenceNumber(long n)
Sets the sequence number for this message.

NOTE This value should be set by the underlying client middleware, and not the application.


getTimeStamp

public long getTimeStamp()
Returns a timestamp indicating when the message was sent.

Returns:
A long containing the time in milli-seconds.

getSequenceNumber

public long getSequenceNumber()
Returns the relative sequence number of this message. When a message is sent by a client, it denotes the relative sending sequence. When a message is received, it denotes the relative sequence of all messages fetched by the recipient, regardless of the sender.

Returns:
A long identifying the message sequence.

getFormat

public char getFormat()
Identifies the body format as either dataset, text or binary. Valid values include

FORMAT_UNKNOWN ('U')

FORMAT_TEXT ('T')

FORMAT_DATASET ('D')

FORMAT_BINARY ('B')


setFormat

public void setFormat(char t)
Sets the attributes that identifies the type of data contained in the message body.

Valid values include

FORMAT_UNKNOWN ('U')

FORMAT_TEXT ('T')

FORMAT_DATASET ('D')

FORMAT_BINARY ('B')

DataSetMessages default to a format of FORMAT_DATASET.


hasAssignedRecipient

public boolean hasAssignedRecipient()
Determine if there is a recipient identifier value.

Returns:
true if there is a non-null recipient identifier.

hasAssignedTopic

public boolean hasAssignedTopic()
Determines if there is a topic identifier value.

Returns:
true if there is a non-null topic identifier.

hasAssignedCorrelationNumber

public boolean hasAssignedCorrelationNumber()
Determines if there is a correlation identifier value.

Returns:
true if there is a non-null numeric correlation identifier.

hasAssignedKey

public boolean hasAssignedKey()
Determines if there is a key value identifier.

Returns:
true if there is a non-null key identifier.

hasAssignedOriginator

public boolean hasAssignedOriginator()
Determines whether a position has a value (versus null)

Returns:
true of there is a non-null value at position p, else false
Throws:
java.lang.ArrayIndexOutOfBoundsException - if p is not a valid element position.

clone

public java.lang.Object clone()

(c) 2000 - 2003 MQue Systems
All Rights Reserved