HerbertKoelman / cpp-atmi

Application-to-Transaction Monitor Interface (ATMI) C++ library
http://herbertkoelman.github.com/cpp-atmi
Other
7 stars 0 forks source link

Define and implement a facility interface/class to generate correlation ids #14

Open HerbertKoelman opened 11 years ago

HerbertKoelman commented 11 years ago

Maybe something like UUID or a combination made of .

When an instance is passes to a Queue instance than each message sent through Queue::enqueue will be tagged with a correids. This value is saved and will automatically used in Queue::dequeue calls.

Something like this:

class CorrelationID {
public:
  const char *next() = 0
  void reset () =0 ;
}
HerbertKoelman commented 11 years ago

Added two methods instead:

The first method set flags and value of corrid. Meaning that all subsequent calls to dequeue will try to dequeue only message having the last set corrid.

A usage sequence would be:

Buffer buffer ;
// set fields in buffer

Queue q ("QUEUE");
q.set_new_corrid(); // Correlation is set into QCTL structure

q.enqueue ( buffer ); // enqueue message 
q.dequeue ( buffer ); // retrieve message only if corrid is the one that was previously set
...