com.pcbsys.nirvana.base.nConsumeEvent Class Reference

This class defines the nirvana event that publishers publish and subscribers receive. More...

Inheritance diagram for com.pcbsys.nirvana.base.nConsumeEvent:
com.pcbsys.nirvana.client.nConsumeEvent com.pcbsys.nirvana.client.nProtobufEvent

Public Member Functions

void ack (boolean isSynchronous, boolean ackPrevious) throws Exception
 Sends an acknowledgment request for this nConsumeEvent. More...
 
void ack (boolean isSynchronous) throws Exception
 Sends an ack for this event to the server, we will ack all previous events. More...
 
void ack (long timeout, boolean isSynchronous, boolean ackPrevious) throws Exception
 Sends an ack for this event to the server, if a timeout value is passed, the ack will be retried if there is a failure. More...
 
void ack (long timeout) throws Exception
 Sends an ack for this event to the server, if a timeout value is passed, the ack will be retried if there is a failure. More...
 
Document getDocument ()
 Gets the XML DOM Document associated with this event, if set. More...
 
byte[] getEventData ()
 Gets the event data set for this event. More...
 
long getEventID ()
 Gets the unique (for its channel) event id value. More...
 
String getEventTag ()
 Gets the event tag set for this event. More...
 
nEventProperties getProperties ()
 Gets this event's properties. More...
 
byte[] getSignature ()
 Returns the digital signature of the event if it was signed by the publisher else it returns null. More...
 
long getTTL ()
 Returns how long the event will be stored on disk in a mixed channel. More...
 
boolean isDom ()
 Gets the isDom flag to find out if the event is marked as XML DOM. More...
 
boolean isEndOfChannel ()
 When you subscribe to a channel, and the channel's data contains a finite and reasonably static set of events, the last event in the channel is sent and marked as the end of the channel. More...
 
boolean isPersistant ()
 Returns the perisitant flag. More...
 
 nConsumeEvent (byte[] tag, byte[] data)
 Constructs a new nConsumeEvent with the specified event tag and data. More...
 
 nConsumeEvent (String tag, byte[] data)
 Constructs a new nConsumeEvent with the specified event tag and data. More...
 
 nConsumeEvent (String tag, byte[] data, boolean dom)
 Constructs a new nConsumeEvent with the specified event tag and data. More...
 
 nConsumeEvent (String tag, nEventProperties properties, byte[] data)
 Constructs a new nConsumeEvent with the specified event properties and data. More...
 
 nConsumeEvent (String tag, Document adom)
 Constructs a new nConsumeEvent with the specified event tag and XML data. More...
 
 nConsumeEvent (nEventProperties properties, Document adom)
 Constructs a new nConsumeEvent with the specified event tag and XML data. More...
 
void rollback (boolean isSynchronous) throws Exception
 Requests the server to roll back this nConsumeEvent. More...
 
void rollback (boolean isSynchronous, boolean individualRollback) throws Exception
 Requests the server to roll back this nConsumeEvent. More...
 
void rollback (long timeout, boolean isSynchronous, boolean individualRollback) throws Exception
 Tells the server that it does not ack this event, if a timeout value is passed, the rollback will be retried if there is a failure. More...
 
void setEventID (long newID)
 Sets the event id value of this event. More...
 
void setPersistant (boolean flag)
 Sets the persistant flag. More...
 
void setProperties (nEventProperties newProperties)
 Sets this event's properties. More...
 
void setTTL (long ttl)
 Sets the TTL for this event. More...
 

Protected Member Functions

void encodeDOM (xmlHelper helper)
 Encode the Dom in this conduit event to byte[]. More...
 

Detailed Description

This class defines the nirvana event that publishers publish and subscribers receive.

Constructor & Destructor Documentation

com.pcbsys.nirvana.base.nConsumeEvent.nConsumeEvent ( byte[]  tag,
byte[]  data 
)

Constructs a new nConsumeEvent with the specified event tag and data.

Parameters
tagthe event tag byte[] encoded
datathe event data byte[] encoded
com.pcbsys.nirvana.base.nConsumeEvent.nConsumeEvent ( String  tag,
byte[]  data 
)

Constructs a new nConsumeEvent with the specified event tag and data.

Parameters
tagthe event tag as a string
datathe event data byte[] encoded
com.pcbsys.nirvana.base.nConsumeEvent.nConsumeEvent ( String  tag,
byte[]  data,
boolean  dom 
)

Constructs a new nConsumeEvent with the specified event tag and data.

The event will be flagged as an XML DOM document if the dom flag is true.

Parameters
tagthe event tag as a string
datathe event data byte[] encoded
doma flag specifying whether the event should be marked as an XML DOM document
com.pcbsys.nirvana.base.nConsumeEvent.nConsumeEvent ( String  tag,
nEventProperties  properties,
byte[]  data 
)

Constructs a new nConsumeEvent with the specified event properties and data.

The event properties can be used to create filter rules.

Parameters
tagthe event tag as a string
propertiesthe collection of key-value pairs that can be used for filter rules
datathe event data byte[] encoded
com.pcbsys.nirvana.base.nConsumeEvent.nConsumeEvent ( String  tag,
Document  adom 
)

Constructs a new nConsumeEvent with the specified event tag and XML data.

The event will be flagged as an XML DOM document.

Parameters
tagthe event tag as a string
adomthe event data as an XML DOM document
com.pcbsys.nirvana.base.nConsumeEvent.nConsumeEvent ( nEventProperties  properties,
Document  adom 
)

Constructs a new nConsumeEvent with the specified event tag and XML data.

The event will be flagged as an XML DOM document.

Parameters
properties<Enter Parameter Description>
adomthe event data as an XML DOM document

Member Function Documentation

void com.pcbsys.nirvana.base.nConsumeEvent.ack ( boolean  isSynchronous,
boolean  ackPrevious 
) throws Exception

Sends an acknowledgment request for this nConsumeEvent.

Parameters
isSynchronouswhen set to true we will not return until the server has processed this call, if false we return once we send the request
ackPreviousWhen set to true will ack all nConsumeEvent up to and including this nConsumeEvent, false can only be used with Queue's or Shared Durables (including nDurableType.SharedQueued)
Exceptions
ExceptionIf unable to send the rollback request to the server
void com.pcbsys.nirvana.base.nConsumeEvent.ack ( boolean  isSynchronous) throws Exception

Sends an ack for this event to the server, we will ack all previous events.

Parameters
isSynchronouswhen set to true we will not return until the server has processed this call, if false we return once we send the request
Exceptions
ExceptionIf unable to send the rollback request to the server
void com.pcbsys.nirvana.base.nConsumeEvent.ack ( long  timeout,
boolean  isSynchronous,
boolean  ackPrevious 
) throws Exception

Sends an ack for this event to the server, if a timeout value is passed, the ack will be retried if there is a failure.

A timeout of <0 denotes infinite retry attempts, 0 denotes no retries, and >0 is the timeout value that will be honored.

Parameters
timeoutspecify a timeout to enable retrying of the acknowledgement in case of a disconnection or failure
isSynchronouswhen set to true we will not return until the server has processed this call, if false we return once we send the request
ackPreviousWhen set to true will ack all nConsumeEvent up to and including this nConsumeEvent, false can only be used with Queue's or Shared Durables (including nDurableType.SharedQueued)
Exceptions
ExceptionIf unable to send the rollback request to the server
void com.pcbsys.nirvana.base.nConsumeEvent.ack ( long  timeout) throws Exception

Sends an ack for this event to the server, if a timeout value is passed, the ack will be retried if there is a failure.

A timeout of <0 denotes infinite retry attempts, 0 denotes no retries, and >0 is the timeout value that will be honored. This will acknowledge all nConsumeEvent up to and including this nConsumeEvent and will also await a response from the server

Parameters
timeoutspecify a timeout to enable retrying of the acknowledgement in case of a disconnection or failure
Exceptions
ExceptionIf unable to send the rollback request to the server
void com.pcbsys.nirvana.base.nConsumeEvent.encodeDOM ( xmlHelper  helper)
protected

Encode the Dom in this conduit event to byte[].

An internal method not to be used by individuals writing Nirvana applications.

Document com.pcbsys.nirvana.base.nConsumeEvent.getDocument ( )

Gets the XML DOM Document associated with this event, if set.

Returns
the XML DOM Document associated with this event, or null if unset.
byte [] com.pcbsys.nirvana.base.nConsumeEvent.getEventData ( )

Gets the event data set for this event.

Returns
a byte[] containing the encoded event data in the form it travels on the network
long com.pcbsys.nirvana.base.nConsumeEvent.getEventID ( )

Gets the unique (for its channel) event id value.

Returns
a long specifying the unique (for its channel) event id attribute
String com.pcbsys.nirvana.base.nConsumeEvent.getEventTag ( )

Gets the event tag set for this event.

Returns
a string specifying the event tag set for this event
nEventProperties com.pcbsys.nirvana.base.nConsumeEvent.getProperties ( )

Gets this event's properties.

Returns
the collection of key-value pairs used to create filter rules
byte [] com.pcbsys.nirvana.base.nConsumeEvent.getSignature ( )

Returns the digital signature of the event if it was signed by the publisher else it returns null.

Returns
Variable length byte[] of the signature
long com.pcbsys.nirvana.base.nConsumeEvent.getTTL ( )

Returns how long the event will be stored on disk in a mixed channel.

Returns
Long millisecond time to keep on the server
boolean com.pcbsys.nirvana.base.nConsumeEvent.isDom ( )

Gets the isDom flag to find out if the event is marked as XML DOM.

Returns
A boolean specifying whether the event is marked as XML DOM
boolean com.pcbsys.nirvana.base.nConsumeEvent.isEndOfChannel ( )

When you subscribe to a channel, and the channel's data contains a finite and reasonably static set of events, the last event in the channel is sent and marked as the end of the channel.

Returns
boolean flag indicating if this is the last event in the channel
Since
4.0
boolean com.pcbsys.nirvana.base.nConsumeEvent.isPersistant ( )

Returns the perisitant flag.

If true the event is stored to disk on the server

Returns
boolean flag
void com.pcbsys.nirvana.base.nConsumeEvent.rollback ( boolean  isSynchronous) throws Exception

Requests the server to roll back this nConsumeEvent.

Parameters
isSynchronousif true we will wait for a response from server
Exceptions
ExceptionIf unable to send the rollback request to the server
void com.pcbsys.nirvana.base.nConsumeEvent.rollback ( boolean  isSynchronous,
boolean  individualRollback 
) throws Exception

Requests the server to roll back this nConsumeEvent.

Exceptions
ExceptionIf unable to send the rollback request to the server
void com.pcbsys.nirvana.base.nConsumeEvent.rollback ( long  timeout,
boolean  isSynchronous,
boolean  individualRollback 
) throws Exception

Tells the server that it does not ack this event, if a timeout value is passed, the rollback will be retried if there is a failure.

A timeout of <0 denotes infinite retry attempts, 0 denotes no retries, and >0 is the timeout value that will be honored.

Parameters
timeoutspecify a timeout to enable retrying of the rollback
isSynchronouswhen set to true we will not return until the server has processed this call, if false we return once we send the request
individualRollbackif true, discard only this nConsumeEvent and request redelivery. If false, keep this nConsumeEvent but redeliver anything received after this event.
Exceptions
ExceptionIf unable to send the rollback request to the server
void com.pcbsys.nirvana.base.nConsumeEvent.setEventID ( long  newID)

Sets the event id value of this event.

Parameters
newIDa long specifying the new event ID of the event
void com.pcbsys.nirvana.base.nConsumeEvent.setPersistant ( boolean  flag)

Sets the persistant flag.

On mixed channels, if set, will cause this event to be stored to disk

Parameters
flagboolean flag
void com.pcbsys.nirvana.base.nConsumeEvent.setProperties ( nEventProperties  newProperties)

Sets this event's properties.

Parameters
newPropertiesThe properties to set for this event
void com.pcbsys.nirvana.base.nConsumeEvent.setTTL ( long  ttl)

Sets the TTL for this event.

On a mixe channel this time is how long the event is kept

Parameters
ttlTime in milliseconds