com.pcbsys.nirvana.client.nConsumeEvent Class Reference

This class represents a Nirvana event, which consists of either a tag and some data or an event dictionary and some data. More...

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

com.pcbsys.nirvana.client.nProtobufEvent

Public Member Functions

void ack () throws Exception
 Sends an ack for this event to the server.
void ack (boolean isSynchronous) throws Exception
 Sends an ack for this event to the server.
nEventAttributes getAttributes ()
 Method that returns the nEventAttributes for this event.
String getChannelName ()
 This function will return the name of the channel / queue that the event was delivered from.
String getDataGroupName ()
 Get the name of the nDataGroup that this event was published to Returns the name.
Document getDocument ()
 Gets the XML DOM Document associated with this event, if set.
byte[] getEventData ()
 Gets the event data set for this event.
long getEventID ()
 Gets the unique (for its channel) event id value.
String getEventTag ()
 Gets the event tag set for this event.
String getFullChannelName () throws nBaseClientException
 This function will return the fully qualified name of the channel / queue that the event was delivered from.
nEventProperties getProperties ()
 Gets this event's properties.
String getPublishHost ()
 Return the hostname from which the event was published.
String getPublishUser ()
 Return the id of the user that published this event.
byte[] getSignature ()
 Returns the digital signature of the event if it was signed by the publisher else it returns null.
long getTimestamp ()
 Return the timestamp of this event.
long getTTL ()
 Returns how long the event will be stored on disk in a mixed channel.
boolean hasAttributes ()
 Method indicating whether there is an nEventAttributes associated with this event.
boolean isDom ()
 Gets the isDom flag to find out if the event is marked as XML DOM.
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.
boolean isPersistant ()
 Returns the perisitant flag.
boolean isTransient ()
 Returns whether the event is transient.
 nConsumeEvent (nEventProperties properties, Document adom)
 Constructs a new nConsumeEvent with the specified event tag and XML data.
 nConsumeEvent (String tag, Document adom)
 Constructs a new nConsumeEvent with the specified event tag and XML data.
 nConsumeEvent (String tag, nEventProperties properties, byte[] data)
 Constructs a new nConsumeEvent with the specified event properties and data.
 nConsumeEvent (nEventProperties properties, byte[] data)
 Constructs a new nConsumeEvent with the specified event properties and data.
 nConsumeEvent (String tag, byte[] data, boolean dom)
 Constructs a new nConsumeEvent with the specified event tag and data.
 nConsumeEvent (String tag, byte[] data)
 Constructs a new nConsumeEvent with the specified event tag and data.
 nConsumeEvent (byte[] tag, byte[] data)
 Constructs a new nConsumeEvent with the specified event tag and data.
void rollback () throws Exception
 Tells the server that it does not ack this event.
void rollback (boolean isSynchronous) throws Exception
 Sends a rollback for this event to the server.
void setAttributes (nEventAttributes attributes)
 Method that sets the nEventAttributes for this event.
void setEventID (long p_id)
 Set the eventID for this event.
void setPersistant (boolean flag)
 Sets the persistant flag.
void setSubscriberHost (byte[] host)
 Sets the host name or ip address representing the consumers of this event.
void setSubscriberName (byte[] subName)
 Sets the session name that will be the only consumer of this event.
void setSubscriberNames (String[] subName)
 Sets the session names that will be the only consumers of this event.
void setTransient (boolean flag)
 Sets whether the event is transient.
void setTTL (long ttl)
 Sets the TTL for this event.
byte[] sign (nMessageSigner signer) throws Exception
 This function will return a byte[] representing a signature of the nConsumeEvent.
synchronized Object validate (nMessageValidator validator) throws Exception
 This function will validate this nConsumeEvent object with the validator.

Detailed Description

This class represents a Nirvana event, which consists of either a tag and some data or an event dictionary and some data.

Constructor & Destructor Documentation

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

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

Parameters:
tag the event tag byte[] encoded
data the event data byte[] encoded

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

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

Parameters:
tag the event tag as a string
data the event data byte[] encoded

com.pcbsys.nirvana.client.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:
tag the event tag as a string
data the event data byte[] encoded
dom a flag specifying whether the event should be marked as an XML DOM document

com.pcbsys.nirvana.client.nConsumeEvent.nConsumeEvent ( 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:
properties the collection of key-value pairs that can be used for filter rules
data the event data byte[] encoded

com.pcbsys.nirvana.client.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:
properties the collection of key-value pairs that can be used for filter rules
data the event data byte[] encoded

com.pcbsys.nirvana.client.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:
tag the event tag as a string
adom the event data as an XML DOM document

com.pcbsys.nirvana.client.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 the collection of key-value pairs that can be used for filter rules
adom the event data as an XML DOM document


Member Function Documentation

void com.pcbsys.nirvana.client.nConsumeEvent.ack (  )  throws Exception

Sends an ack for this event to the server.

Exceptions:
Exception If unable to send the ack request to the server

void com.pcbsys.nirvana.client.nConsumeEvent.ack ( boolean  isSynchronous  )  throws Exception

Sends an ack for this event to the server.

Parameters:
isSynchronous whether the acknowledgement will be synnchronous
Exceptions:
Exception If unable to send the ack request to the server

nEventAttributes com.pcbsys.nirvana.client.nConsumeEvent.getAttributes (  ) 

Method that returns the nEventAttributes for this event.

Returns:
the nEventAttributes for this event
Since:
4.0
See also:
nEventAttributes

String com.pcbsys.nirvana.client.nConsumeEvent.getChannelName (  ) 

This function will return the name of the channel / queue that the event was delivered from.

Returns:
the name of the channel or queue

String com.pcbsys.nirvana.client.nConsumeEvent.getDataGroupName (  ) 

Get the name of the nDataGroup that this event was published to Returns the name.

Returns:

Document com.pcbsys.nirvana.client.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.client.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.client.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.client.nConsumeEvent.getEventTag (  ) 

Gets the event tag set for this event.

Returns:
a string specifying the event tag set for this event

String com.pcbsys.nirvana.client.nConsumeEvent.getFullChannelName (  )  throws nBaseClientException

This function will return the fully qualified name of the channel / queue that the event was delivered from.

Returns:
the fully qualified name of the channel or queue
Exceptions:
nBaseClientException If the fully qualified name is not set
Since:
3.1

nEventProperties com.pcbsys.nirvana.client.nConsumeEvent.getProperties (  ) 

Gets this event's properties.

Returns:
the collection of key-value pairs used to create filter rules

String com.pcbsys.nirvana.client.nConsumeEvent.getPublishHost (  ) 

Return the hostname from which the event was published.

This value will be obtained from the nEventAttributes associated with this event.

Returns:
the hostname from which the event was published
Since:
4.0
See also:
nEventAttributes

String com.pcbsys.nirvana.client.nConsumeEvent.getPublishUser (  ) 

Return the id of the user that published this event.

This value will be obtained from the nEventAttributes associated with this event.

Returns:
the user who published this event
Since:
4.0
See also:
nEventAttributes

byte [] com.pcbsys.nirvana.client.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.client.nConsumeEvent.getTimestamp (  ) 

Return the timestamp of this event.

This value will be obtained from the nEventAttributes associated with this event.

Returns:
the timestamp when the event was received by the server
Since:
4.0
See also:
nEventAttributes

long com.pcbsys.nirvana.client.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.client.nConsumeEvent.hasAttributes (  ) 

Method indicating whether there is an nEventAttributes associated with this event.

Returns:
whether the nEventAttributes exists for this event
Since:
4.0
See also:
nEventAttributes

boolean com.pcbsys.nirvana.client.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.client.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.client.nConsumeEvent.isPersistant (  ) 

Returns the perisitant flag.

If true the event is stored to disk on the server

Returns:
boolean flag

boolean com.pcbsys.nirvana.client.nConsumeEvent.isTransient (  ) 

Returns whether the event is transient.

If the event itself is transient, it will never be stored either in memory or on disk by the realm server, but simply discarded once it has been delivered to any consumers. This is the equivilent of publishing events on a Transient channel, however allows the transience to be specified on a per event basis.

Returns:
whether the event is transient
See also:
nChannelAttributes
Since:
4.0

void com.pcbsys.nirvana.client.nConsumeEvent.rollback (  )  throws Exception

Tells the server that it does not ack this event.

Exceptions:
Exception If unable to send the rollback request to the server

void com.pcbsys.nirvana.client.nConsumeEvent.rollback ( boolean  isSynchronous  )  throws Exception

Sends a rollback for this event to the server.

Parameters:
isSynchronous whether the rollback will be synnchronous
Exceptions:
Exception If unable to send the rollback request to the server

void com.pcbsys.nirvana.client.nConsumeEvent.setAttributes ( nEventAttributes  attributes  ) 

Method that sets the nEventAttributes for this event.

Parameters:
attributes nEventAttributes for this event
Since:
4.0
See also:
nEventAttributes

void com.pcbsys.nirvana.client.nConsumeEvent.setEventID ( long  p_id  ) 

Set the eventID for this event.

This method is for internal Nirvana use only

Parameters:
p_id the eventID for this event

void com.pcbsys.nirvana.client.nConsumeEvent.setPersistant ( boolean  flag  ) 

Sets the persistant flag.

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

Parameters:
flag boolean flag

void com.pcbsys.nirvana.client.nConsumeEvent.setSubscriberHost ( byte[]  host  ) 

Sets the host name or ip address representing the consumers of this event.

By setting this, only connections matching the host name or ip address will consume this event. Wildcard * are also supported, so you can have *.abc.com fore example

Parameters:
host - the host name or ip address of connections that will consume this event

void com.pcbsys.nirvana.client.nConsumeEvent.setSubscriberName ( byte[]  subName  ) 

Sets the session name that will be the only consumer of this event.

By setting this, no other subscribers, either on a queue or channel will consume this event.

Parameters:
subName - the subscriber name, equal to the session name of the designated user

void com.pcbsys.nirvana.client.nConsumeEvent.setSubscriberNames ( String[]  subName  ) 

Sets the session names that will be the only consumers of this event.

By setting this, no other subscribers, either on a queue or channel will consume this event.

Parameters:
subName - the subscriber names, equal to the session names of the designated users

void com.pcbsys.nirvana.client.nConsumeEvent.setTransient ( boolean  flag  ) 

Sets whether the event is transient.

If the event itself is transient, it will never be stored either in memory or on disk by the realm server, but simply discarded once it has been delivered to any consumers. This is the equivilent of publishing events on a Transient channel, however allows the transience to be specified on a per event basis.

Parameters:
flag whether the event is transient

void com.pcbsys.nirvana.client.nConsumeEvent.setTTL ( long  ttl  ) 

Sets the TTL for this event.

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

Parameters:
ttl Time in milliseconds

byte [] com.pcbsys.nirvana.client.nConsumeEvent.sign ( nMessageSigner  signer  )  throws Exception

This function will return a byte[] representing a signature of the nConsumeEvent.

The format and type of the signature is defined by the implementation of the nMessageSigner.

Parameters:
signer An implementation of a nMessageSigner interface
Returns:
byte[] signature
Exceptions:
Exception Depending on the implementation of the signer depends on what exceptions could be thrown

synchronized Object com.pcbsys.nirvana.client.nConsumeEvent.validate ( nMessageValidator  validator  )  throws Exception

This function will validate this nConsumeEvent object with the validator.

It does this by calling the validator with this objects data and comparing the signature of this nConsumeEvent.

Parameters:
validator An implementation of a nMessageValidator
Returns:
Object Depending on the the implementation of the nMessageValidator depends on what is returned. For example if the nMessageValidator uses a X.509 certificate to perform a SHA1withRSA signature then the return object would be the X.509 certificate.
Exceptions:
Exception Depending on the implementation of the nMessageValidator