com.neeve.sma.event
Class MessageEvent

java.lang.Object
  extended by com.neeve.util.UtlListElement
      extended by com.neeve.event.Event
          extended by com.neeve.sma.event.MessageEvent
All Implemented Interfaces:
IEvent, MessageChannelEvent, UtlPool.Item<Event>, UtlReferenceTracker.HasReferenceTracker

public final class MessageEvent
extends Event
implements MessageChannelEvent

Event notifying the the receipt of a message.

Threading:
This class is safe for concurrent access by multiple threads.

Field Summary
 
Fields inherited from class com.neeve.util.UtlListElement
count, head, next, prev
 
Method Summary
static MessageEvent create(MessageBusBinding binding, MessageChannel channel, MessageView view, IEventAcknowledger acknowledger)
          Create a new (initialized) message event.
static Event create(Properties props)
          Create a new (uninitialized) message event.
 boolean getAutoAck()
          Get whether the message associated with this event should be auto acknowledged upon return from the event handler.
 MessageChannel getMessageChannel()
          Implementation of MessageChannelEvent.getMessageChannel()
 MessageView getMessageView()
          Get the received message (view).
 boolean isLocal()
          Tests if this MessageEvent originated locally.
 void setAutoAck(boolean val)
          Set whether the message associated with this event should be auto acknowledged upon return from the event handler.
 String toString()
          Get a string representation of a message event.
 
Methods inherited from class com.neeve.event.Event
acquire, dispose, getAcknowledger, getAttachment, getDelay, getDispatchTime, getInstanceNumber, getOfferTs, getPollTs, getPool, getRemainingTime, getScheduledTime, getSource, getType, init, isEndOfBatch, isHandled, owners, referenceTracker, setAcknowledger, setAttachment, setDelay, setDispatchTime, setEndOfBatch, setHandled, setPool, setScheduledTime, setSource
 
Methods inherited from class com.neeve.util.UtlListElement
count, insertAfter, insertBefore, isLinked, next, previous, unlink, wipe
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static Event create(Properties props)
Create a new (uninitialized) message event.

This method instantiates a new message event object. The method is for use by the event factory to instantiate new message events. The method should not be used directly by the user since the method bypasses any event pooling i.e. it creates a new message event object even if there are eligible event objects available in the event type's pool.


create

public static MessageEvent create(MessageBusBinding binding,
                                  MessageChannel channel,
                                  MessageView view,
                                  IEventAcknowledger acknowledger)
Create a new (initialized) message event.

Parameters:
binding - The binding from where this event originated
channel - The channel through where the message was received.
view - A view of the received message.

This method instantiates and initializes a message event. The method uses the packet factory to instantiate a new message evemt (the factory recycles objects through the event type's object pool is configured for the type) and then initializes it with the supplied parameters.


getMessageChannel

public final MessageChannel getMessageChannel()
Implementation of MessageChannelEvent.getMessageChannel()

Specified by:
getMessageChannel in interface MessageChannelEvent

getMessageView

public final MessageView getMessageView()
Get the received message (view).

Threading:
This method is safe for concurrent access by multiple threads.

setAutoAck

public final void setAutoAck(boolean val)
Set whether the message associated with this event should be auto acknowledged upon return from the event handler.

Threading:
This method is safe for concurrent access by multiple threads.

Setting the auto-ack attribute to true will cause the SMA runtime to automatically acknowledge a message upon successful return from the user event handler. This attribute is only applicable to guaranteed messages. The default value for this attribute is true i.e. if not explicitly specified via this attribute guaranteed messages that are successfully processed (i.e. no exception thrown by the user event handler) are automatically acknowledged by the SMA runtime.


getAutoAck

public final boolean getAutoAck()
Get whether the message associated with this event should be auto acknowledged upon return from the event handler.

Threading:
This method is safe for concurrent access by multiple threads.

isLocal

public final boolean isLocal()
Tests if this MessageEvent originated locally. A MessageEvent for a message that does not have a channel name is considered to be a 'local' message.

Specified by:
isLocal in interface MessageChannelEvent
Returns:
true if the message originated locally.

toString

public final String toString()
Get a string representation of a message event.

Overrides:
toString in class Event


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.