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...

#include <nConsumeEvent.h>

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

Public Member Functions

void ack ()
 Sends an ack for this event to the server. More...
 
nEventAttributesgetAttributes ()
 Method that returns the nEventAttributes for this event. More...
 
std::string getChannelName ()
 This function will return the name of the channel / queue that the event was delivered from. More...
 
const std::string & getDataGroupName ()
 Get the name of the nDataGroup that this event was published to Returns the name. More...
 
unsigned char * getEventData ()
 Gets the event data set for this event. More...
 
longlong getEventID ()
 Gets the unique (for its channel) event id value. More...
 
std::string & getEventTag ()
 Gets the event tag set for this event. More...
 
std::string getFullChannelName ()
 This function will return the fully qualified name of the channel / queue that the event was delivered from. More...
 
nEventPropertiesgetProperties ()
 Gets this event's properties. More...
 
void getPublishHost (std::string &pubHost)
 Return the host name from which the event was published. More...
 
void getPublishUser (std::string &pubUser)
 Return the id of the user that published this event. More...
 
unsigned char * getSignature ()
 Returns the digital signature of the event if it was signed by the publisher else it returns null. More...
 
longlong getTimestamp ()
 Return the time stamp of this event. More...
 
longlong getTTL ()
 Returns how long the event will be stored on disk in a mixed channel. More...
 
bool hasAttributes ()
 Method indicating whether there is an nEventAttributes associated with this event. More...
 
bool 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...
 
bool isPersistent ()
 Returns the persistent flag. More...
 
virtual bool isProtoBuffEvent ()
 Method to identify whether this event has been constructed with a Google Protocol Buffer message. More...
 
bool isTransient ()
 Returns whether the event is transient. More...
 
 nConsumeEvent (nEventProperties *pProperties, unsigned char *data, int dataLength)
 Constructs a new nConsumeEvent with the specified event properties and data. More...
 
 nConsumeEvent (const std::string &tag, nEventProperties *pProperties, unsigned char *data, int dataLength)
 Constructs a new nConsumeEvent with the specified tag, event properties and data. More...
 
 nConsumeEvent (unsigned char *tag, int tagLength, nEventProperties *pProperties, unsigned char *data, int dataLength)
 Constructs a new nConsumeEvent with the specified tag, event properties and data. More...
 
 nConsumeEvent (unsigned char *tag, int tagLength, unsigned char *data, int dataLength)
 Constructs a new nConsumeEvent with the specified event tag and data. More...
 
 nConsumeEvent (const std::string &tag, unsigned char *data, int dataLength)
 Constructs a new nConsumeEvent with the specified event tag and data. More...
 
 nConsumeEvent (nEventProperties *pProperties, std::string &tag)
 Constructs a new nConsumeEvent with the specified event properties and tag. More...
 
void rollback ()
 Tells the server that it does not ack this event. More...
 
void setAttributes (nEventAttributes *pAttributes)
 Method that sets the nEventAttributes for this event. More...
 
void setPersistent (bool flag)
 Sets the persistent flag. More...
 
void setProperties (nEventProperties *newProperties)
 Sets this event's properties. More...
 
void setSubscriberHost (unsigned char *host, int length)
 Sets the host name or ip address representing the consumers of this event. More...
 
void setSubscriberName (unsigned char *subName, int length)
 Sets the session name that will be the only consumer of this event. More...
 
void setSubscriberNames (std::string *subName, int length)
 Sets the session names that will be the only consumers of this event. More...
 
void setTransient (bool flag)
 Sets whether the event is transient. More...
 
void setTTL (longlong ttl)
 Sets the TTL for this event. More...
 

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 ( nEventProperties pProperties,
unsigned char *  data,
int  dataLength 
)

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

The event properties can be used to create filter rules.

Parameters
*pPropertiesthe collection of key-value pairs that can be used for filter rules
datathe event data byte[] encoded
dataLengththe length of the data
com::pcbsys::nirvana::client::nConsumeEvent::nConsumeEvent ( const std::string &  tag,
nEventProperties pProperties,
unsigned char *  data,
int  dataLength 
)

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

The event properties can be used to create filter rules.

Parameters
tagthe event tag as a string
*pPropertiesthe collection of key-value pairs that can be used for filter rules
datathe event data byte[] encoded
dataLengththe length of the data
com::pcbsys::nirvana::client::nConsumeEvent::nConsumeEvent ( unsigned char *  tag,
int  tagLength,
nEventProperties pProperties,
unsigned char *  data,
int  dataLength 
)

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

The event properties can be used to create filter rules.

Parameters
tagthe event tag byte[] encoded
tagLengththe length of the tag
*pPropertiesthe collection of key-value pairs that can be used for filter rules
datathe event data byte[] encoded
dataLengththe length of the data
com::pcbsys::nirvana::client::nConsumeEvent::nConsumeEvent ( unsigned char *  tag,
int  tagLength,
unsigned char *  data,
int  dataLength 
)

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

Parameters
tagthe event tag byte[] encoded
tagLengththe length of the tag
datathe event data byte[] encoded
dataLengththe length of the data
com::pcbsys::nirvana::client::nConsumeEvent::nConsumeEvent ( const std::string &  tag,
unsigned char *  data,
int  dataLength 
)

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

Parameters
tagthe event tag as a string
datathe event data byte[] encoded
dataLengththe length of the data
com::pcbsys::nirvana::client::nConsumeEvent::nConsumeEvent ( nEventProperties pProperties,
std::string &  tag 
)

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

The event properties can be used to create filter rules.

Parameters
*pPropertiesthe collection of key-value pairs that can be used for filter rules
tagthe event tag

Member Function Documentation

void com::pcbsys::nirvana::client::nConsumeEvent::ack ( )

Sends an ack for this event to the server.

Exceptions
ExceptionIf unable to send the rollback 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
std::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
const std::string& com::pcbsys::nirvana::client::nConsumeEvent::getDataGroupName ( )

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

Returns
unsigned char* com::pcbsys::nirvana::client::nConsumeEvent::getEventData ( )

Gets the event data set for this event.

Returns
a unsigned char[] containing the encoded event data in the form it travels on the network
longlong 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
std::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
std::string com::pcbsys::nirvana::client::nConsumeEvent::getFullChannelName ( )

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
nBaseClientExceptionIf 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
void com::pcbsys::nirvana::client::nConsumeEvent::getPublishHost ( std::string &  pubHost)

Return the host name from which the event was published.

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

Returns
the host name from which the event was published
Since
4.0
See Also
nEventAttributes
void com::pcbsys::nirvana::client::nConsumeEvent::getPublishUser ( std::string &  pubUser)

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
unsigned char* 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
longlong com::pcbsys::nirvana::client::nConsumeEvent::getTimestamp ( )

Return the time stamp of this event.

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

Returns
the time stamp when the event was received by the server
Since
4.0
See Also
nEventAttributes
longlong 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
bool 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
bool 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
bool flag indicating if this is the last event in the channel
Since
4.0
bool com::pcbsys::nirvana::client::nConsumeEvent::isPersistent ( )

Returns the persistent flag.

If true the event is stored to disk on the server

Returns
bool flag
virtual bool com::pcbsys::nirvana::client::nConsumeEvent::isProtoBuffEvent ( )
virtual

Method to identify whether this event has been constructed with a Google Protocol Buffer message.

Will return true or false

Reimplemented in com::pcbsys::nirvana::client::nProtobufEvent.

bool 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 equivalent 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 ( )

Tells the server that it does not ack this event.

Exceptions
ExceptionIf unable to send the rollback request to the server
void com::pcbsys::nirvana::client::nConsumeEvent::setAttributes ( nEventAttributes pAttributes)

Method that sets the nEventAttributes for this event.

Parameters
*pAttributesnEventAttributes for this event
Since
4.0
See Also
nEventAttributes
void com::pcbsys::nirvana::client::nConsumeEvent::setPersistent ( bool  flag)

Sets the persistent flag.

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

Parameters
flagbool flag
void com::pcbsys::nirvana::client::nConsumeEvent::setProperties ( nEventProperties newProperties)

Sets this event's properties.

void com::pcbsys::nirvana::client::nConsumeEvent::setSubscriberHost ( unsigned char *  host,
int  length 
)

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
length- the length of the array
void com::pcbsys::nirvana::client::nConsumeEvent::setSubscriberName ( unsigned char *  subName,
int  length 
)

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
length- the length of the array
void com::pcbsys::nirvana::client::nConsumeEvent::setSubscriberNames ( std::string *  subName,
int  length 
)

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.

Exceptions
nIllegalArgumentExceptionThis exception is thrown if the mySubName array is larger than 32767
Parameters
subName- the subscriber names, equal to the session names of the designated users
length- the length of the array
void com::pcbsys::nirvana::client::nConsumeEvent::setTransient ( bool  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 equivalent of publishing events on a Transient channel, however allows the transience to be specified on a per event basis.

Parameters
flagwhether the event is transient
void com::pcbsys::nirvana::client::nConsumeEvent::setTTL ( longlong  ttl)

Sets the TTL for this event.

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

Parameters
ttlTime in milliseconds