MessagingImplementation.TransactionBasedImplementation Class Reference


Detailed Description

An implementation of the messaging framework.

Currently, this makes use of a global MessageQueue onto which sent messages are queued. A MessageDispatcher is responsible for dispatching these messages to the entities that will process them.

This framework is transaction based. A transaction represents a group of messages that are to be processed together. When a message is sent while another message is being processed *in the same thread*, the message becomes part of the transaction. If a message is sent when no message is being processed in the same thread, the message starts a new transaction.

#include <class_messaging_implementation_1_1_transaction_based_implementation.h>

Inheritance diagram for MessagingImplementation.TransactionBasedImplementation:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  __init__ ()
  createMessage ()
  Creates and returns a message with the given id and data.
  createMessageFromString ()
  Create message.
  createMessagesFromStrings ()
  Given a sequence of strings [message-1-id, message-1-data, message-2-id, ...] return a list of messages [message-1, message-2, ...].
  createMessageDataFromString ()
  sendMessage ()
  Creates a message with the given id and data.
  startProcessMessage ()
  Call this method to indicate that the given message has started to be processed.
  endProcessMessage ()
  Call this method to indicate that the given message has finished being processed.
  getNextMessage ()
  Returns the next message in the current transaction.
  startDispatchMessage ()
  endDispatchMessage ()
  undoMessage ()
  Creates an undo message with the given id and data.
  isUndoMessage ()
  Returns True if the message is an part of an undo operation; False otherwise.
  isUndoRequested ()
  Returns True if undo was requested for the given message; False otherwise.

Member Function Documentation

MessagingImplementation.TransactionBasedImplementation.__init__ ( )
MessagingImplementation.TransactionBasedImplementation.createMessage ( )

Creates and returns a message with the given id and data.

Returns None if a message could not be created due to the message id not being registered, or the expected data being incorrect.

Raises a TypeError exception if the id is not string. Raises a TypeError exception if the data is not a tuple.

Reimplemented from MessagingImplementation.MessagingImplementation.

MessagingImplementation.TransactionBasedImplementation.createMessageFromString ( )

Create message.

messageData is string that will be parsed.

Reimplemented from MessagingImplementation.MessagingImplementation.

MessagingImplementation.TransactionBasedImplementation.createMessagesFromStrings ( )

Given a sequence of strings [message-1-id, message-1-data, message-2-id, ...] return a list of messages [message-1, message-2, ...].

Reimplemented from MessagingImplementation.MessagingImplementation.

MessagingImplementation.TransactionBasedImplementation.createMessageDataFromString ( )
MessagingImplementation.TransactionBasedImplementation.sendMessage ( )

Creates a message with the given id and data.

If the message is successfully created, the undo implementation is called with the message (if undo is requested), and the message is sent. The sent message is returned.

Returns None if a message could not be created due to the message id not being registered, or the expected data being incorrect.

Raises a TypeError exception if the id is not string. Raises a TypeError exception if the data is not a tuple.

Reimplemented from MessagingImplementation.MessagingImplementation.

MessagingImplementation.TransactionBasedImplementation.startProcessMessage ( )

Call this method to indicate that the given message has started to be processed.

Reimplemented from MessagingImplementation.MessagingImplementation.

MessagingImplementation.TransactionBasedImplementation.endProcessMessage ( )

Call this method to indicate that the given message has finished being processed.

Reimplemented from MessagingImplementation.MessagingImplementation.

MessagingImplementation.TransactionBasedImplementation.getNextMessage ( )

Returns the next message in the current transaction.

If there is no current transaction, returns the next message starting a transaction.

Returns None if there are no messages remaining.

Reimplemented from MessagingImplementation.MessagingImplementation.

MessagingImplementation.TransactionBasedImplementation.startDispatchMessage ( )
MessagingImplementation.TransactionBasedImplementation.endDispatchMessage ( )
MessagingImplementation.TransactionBasedImplementation.undoMessage ( )

Creates an undo message with the given id and data.

If the message is successfully created, it is automatically added to the current transaction's undo. Alternatively, if a parent message is specified, then it is added to the parent message's undo, and the parent message is added to the undo queue. The parent message represents the message to undo.

Returns the undo message, or None if a message could not be created due to the message id not being registered, or the expected data being incorrect.

Raises a TypeError exception if the id is not string. Raises a TypeError exception if the data is not a tuple.

Reimplemented from MessagingImplementation.MessagingImplementation.

MessagingImplementation.TransactionBasedImplementation.isUndoMessage ( )

Returns True if the message is an part of an undo operation; False otherwise.

Reimplemented from MessagingImplementation.MessagingImplementation.

MessagingImplementation.TransactionBasedImplementation.isUndoRequested ( )

Returns True if undo was requested for the given message; False otherwise.

Use this method to avoid any operations that are unnecessary if undo was not requested.

Reimplemented from MessagingImplementation.MessagingImplementation.


MessagingImplementation.TransactionBasedImplementation MessagingImplementation.TransactionBasedImplementation MessagingImplementation.TransactionBasedImplementation MessagingImplementation.TransactionBasedImplementation MessagingImplementation.TransactionBasedImplementation MessagingImplementation.TransactionBasedImplementation MessagingImplementation.TransactionBasedImplementation MessagingImplementation.TransactionBasedImplementation MessagingImplementation.TransactionBasedImplementation MessagingImplementation.TransactionBasedImplementation
MessagingImplementation.TransactionBasedImplementation MessagingImplementation.TransactionBasedImplementation MessagingImplementation.TransactionBasedImplementation MessagingImplementation.TransactionBasedImplementation MessagingImplementation.TransactionBasedImplementation MessagingImplementation.TransactionBasedImplementation MessagingImplementation.TransactionBasedImplementation MessagingImplementation.TransactionBasedImplementation MessagingImplementation.TransactionBasedImplementation MessagingImplementation.TransactionBasedImplementation