it_bus_pdk/rm_persistence.h

00001 #ifndef _IT_BUS_PDK_RM_PERSISTENCE_H_
00002 #define _IT_BUS_PDK_RM_PERSISTENCE_H_
00003 
00004 // @Copyright 2006 IONA Technologies, Plc. All Rights Reserved.
00005 //
00006 #include <it_bus/types.h>
00007 
00008 namespace IT_Bus
00009 {
00010     class String;
00011     class QName;
00012     class BinaryBuffer;
00013 
00014     class RMSequencePersistentStore
00015     {
00016       public:
00017 
00018         virtual String
00019         get_sequence_id() = 0;
00020 
00021         virtual String
00022         get_acksto_uri() = 0;
00023 
00024         /*
00025          * Stores the message in the sequence's persistent store.
00026          * The is_last_message flag is used by RM source to indicate
00027          * if it's the last message of the sequence.
00028          * Returns true iff the message is successfully persisted;
00029          * false otherwise.
00030          */
00031         virtual bool
00032         store_message(
00033             IT_Bus::ULong message_id,
00034             BinaryBuffer& message,
00035             bool          is_last_message
00036         ) = 0;
00037 
00038         /*
00039          * Removes the message from the sequence's persistent store.
00040          * The second parameter is used by RM destination (that provides
00041          * InOrder delivery assurance to indicate if the message being
00042          * removed is the highest delivered message id.
00043          */
00044         virtual void
00045         remove_message(
00046             IT_Bus::ULong message_id,
00047             bool          highest_delivered_message_id
00048         ) = 0;
00049 
00050         /*
00051          * Called by the RM destination upon receipt of a WSRM
00052          * acknowledgement to store a stringified representation
00053          * of the WSRM ack.
00054          */
00055         virtual void
00056         store_acknowledgement(
00057             const String& stringified_ack_range
00058         ) = 0;
00059 
00060         /*
00061          * Returns the last message ID. For RM source, it is the last
00062          * message of the sequence (with the wsrm:LastMessage element),
00063          * or returns 0, if the last message has not been persisted.
00064          * For the RM destination, it determines the highest delivered
00065          * message ID for an in-order delivery assurance, and 0 otherwise.
00066          */
00067         virtual IT_Bus::ULong
00068         get_last_message_id() = 0;
00069 
00070         /*
00071          * Called when a WSRM sequence is terminated.
00072          */
00073         virtual void
00074         sequence_terminated() = 0;
00075 
00076         /*
00077          * After the endpoint recovers from a previous crash, this method
00078          * is called in an iterative fashion to get the next message in
00079          * the sequence persistence store.
00080          * The out parameter is the message id of the recovered message.
00081          * It returns 0 if there are no more messages in the store.
00082          * This API is not expected to be called concurrently.
00083          */
00084         virtual BinaryBuffer*
00085         get_next_message_to_recover(
00086             IT_Bus::ULong& message_id
00087         ) = 0;
00088     };
00089 
00090     class RMEndpointPersistentStore
00091     {
00092       public:
00093 
00094         virtual const QName&
00095         get_service_name() = 0;
00096 
00097         virtual String
00098         get_port_name() = 0;
00099 
00100         virtual String
00101         get_address() = 0;
00102 
00103         virtual String
00104         get_stringified_epr() = 0;
00105 
00106         /*
00107          * Called by a non-recovering destination endpoint
00108          * to store endpoint address.
00109          */
00110         virtual void
00111         store_address(
00112             const String& endpoint_address
00113         ) = 0;
00114 
00115         /*
00116          * Called when a WSRM sequence is created.
00117          */
00118         virtual RMSequencePersistentStore*
00119         sequence_created(
00120             const String& sequence_id,
00121             const String& acksto_uri
00122         ) = 0;
00123 
00124         /* Returns true if the RMEndpointPersistentStore
00125          * was already present in the DB, in which case,
00126          * it needs to recover, OR, if it was a new
00127          * entry in the DB, in which case, it returns false.
00128          */
00129         virtual bool
00130         endpoint_needs_recovery() = 0;
00131 
00132         /*
00133          * The following method is called after an endpoint
00134          * recovers from a crash. It returns the next sequence
00135          * to be recovered, or 0, if there are no more sequences
00136          * to be recovered. It SHOULD NOT be called concurrently.
00137          */
00138         virtual RMSequencePersistentStore*
00139         get_next_sequence_to_recover() = 0;
00140     };
00141 
00142     /*
00143      * The following interface creates and manages
00144      * RMEndpointPersistentStore.
00145      */
00146     class RMPersistentManager
00147     {
00148       public:
00149 
00150         /*
00151          * Called when an RM source endpoint is created.
00152          */
00153         virtual RMEndpointPersistentStore*
00154         rm_source_endpoint_created(
00155             const QName&  wsdl_service_qname,
00156             const String& wsdl_port_name,
00157             const String& stringified_wsa_epr,
00158             const String& endpoint_address
00159         ) = 0;
00160 
00161         /*
00162          * Called when an RM source endpoint is created.
00163          */
00164         virtual RMEndpointPersistentStore*
00165         rm_destination_endpoint_created(
00166             const QName&  wsdl_service_qname,
00167             const String& wsdl_port_name,
00168             const String& stringified_wsa_epr
00169         ) = 0;
00170 
00171         /*
00172          * Called when the endpoint is closed.
00173          */
00174         virtual void
00175         rm_endpoint_closed(
00176             RMEndpointPersistentStore* ep_store
00177         ) = 0;
00178 
00179         virtual RMEndpointPersistentStore*
00180         get_next_source_endpoint_to_recover() = 0;
00181 
00182         virtual void
00183         cleanup_persistent_store() = 0;
00184     };
00185 }
00186 
00187 #endif  
00188 

Generated on Tue Mar 20 15:27:53 2007 for Artix by  doxygen 1.5.1-p1