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>


Public Member Functions

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

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

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:
*pProperties the collection of key-value pairs that can be used for filter rules
data the event data byte[] encoded
dataLength the length of the data

nConsumeEvent::nConsumeEvent ( unsigned char *  tag,
int  tagLength,
unsigned char *  data,
int  dataLength 
)

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

Parameters:
tag the event tag byte[] encoded
tagLength the length of the tag
data the event data byte[] encoded
dataLength the length of the data

nConsumeEvent::nConsumeEvent ( const std::string &  tag,
unsigned char *  data,
int  dataLength 
)

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
dataLength the length of the data

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:
*pProperties the collection of key-value pairs that can be used for filter rules
tag the event tag


Member Function Documentation

void nConsumeEvent::ack (  ) 

Sends an ack for this event to the server.

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

nEventAttributes * nConsumeEvent::getAttributes (  ) 

Method that returns the nEventAttributes for this event.

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

std::string 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

unsigned char * 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 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 nConsumeEvent::getEventTag (  ) 

Gets the event tag set for this event.

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

std::string 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:
nBaseClientException If the fully qualified name is not set
Since:
3.1

nEventProperties * nConsumeEvent::getProperties (  ) 

Gets this event's properties.

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

void 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 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 * 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 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 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 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 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 nConsumeEvent::isPersistent (  ) 

Returns the persistent flag.

If true the event is stored to disk on the server

Returns:
bool flag

bool 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 nConsumeEvent::rollback (  ) 

Tells the server that it does not ack this event.

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

void nConsumeEvent::setAttributes ( nEventAttributes pAttributes  ) 

Method that sets the nEventAttributes for this event.

Parameters:
*pAttributes nEventAttributes for this event
Since:
4.0
See also:
nEventAttributes

void nConsumeEvent::setPersistent ( bool  flag  ) 

Sets the persistent flag.

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

Parameters:
flag bool flag

void 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:
flag whether the event is transient

void nConsumeEvent::setTTL ( longlong  ttl  ) 

Sets the TTL for this event.

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

Parameters:
ttl Time in milliseconds

Share this page with others:
Tell Your Tweets Facebook It! Add to Delicious Reddit! Digg It! Stumble Upon Add to Your Faves Mixx it
Follow Us:
Keep up with my-Channels on Twitter Become a fan on Facebook LinkedIn Profile Recent Highlights RSS Feed