public class MSubscriber extends MSubscriberEventSource
MSubscriber
subscribes to network data.
Whenever new data is available, the subscriber generates an
MDataEvent
and calls the onEvent()
method of each registered listener. The subscriber generates
an MTimeoutEvent
if data events have not been
generated within the time frame specified in the data event source.m_app, m_autoConfirm, m_classNames, m_consumer, m_endpointSpec, m_messageFormat, m_numMessagesReceived
m_handlers, m_listeners
m_registry
Constructor and Description |
---|
MSubscriber(MApp app,
java.lang.String name,
MRvSession session,
int protocol,
int timeout)
Construct an inbox subscriber.
|
MSubscriber(MApp app,
java.lang.String name,
MRvSession session,
int protocol,
java.lang.String subject,
int timeout)
Construct an instance of
MSubscriber . |
MSubscriber(MApp app,
java.lang.String name,
java.lang.String sessionName,
int protocol,
int timeout)
Construct an inbox subscriber.
|
MSubscriber(MApp app,
java.lang.String name,
java.lang.String sessionName,
int protocol,
java.lang.String subject,
int timeout)
Construct an instance of
MSubscriber . |
MSubscriber(MComponentRegistry registry,
java.lang.String name,
MEndpointSpec endpointSpec,
boolean autoConfirm)
Constructor for creating an
MSubscriber instance that uses an endpoint specification. |
Modifier and Type | Method and Description |
---|---|
void |
addAdvisoryListener(MEventListener p_listener) |
void |
addClassName(java.lang.String p_className) |
void |
confirm(MDataEvent dataEvent)
Deprecated.
as of TIBCO Adapter SDK 5.0.0.
|
protected void |
createImpl(MComponentRegistry registry,
MEndpointSpec endpointSpec,
boolean autoConfirm) |
MApp |
getApp() |
java.util.Enumeration |
getClassNames()
Enumerate over the list of keys to the objects.
|
int |
getDeliveryMode()
Return the delivery mode of this publisher.
|
java.lang.Object |
getDestination() |
MRvSession |
getMRvSession()
Deprecated.
as of TIBCO Adapter SDK 5.0.0.
|
int |
getProtocol()
Deprecated.
as of TIBCO Adapter SDK 5.0.0.
|
java.lang.String |
getSubjectName()
Deprecated.
as of TIBCO Adapter SDK 5.0.0.
|
long |
getTimeout()
Get the timeout value specified in the constructor.
|
protected void |
init(MComponentRegistry registry,
MEndpointSpec endpointSpec,
boolean isOwner,
boolean autoConfirm) |
void |
noAutoConfirm()
Turn off automatic event confirmation.
|
void |
notify(MEvent p_event)
Trigger an event in each event listener attached to this event source
|
void |
setSubjectName(java.lang.String p_subject) |
void |
validateMessage(boolean doValidate)
Deprecated.
as of TIBCO Adapter SDK 5.0.0.
|
activate, addListener, addTPluginName, deactivate, getDestinationName, getEndpointSpec, getListeners, getMessageFormat, getNumMessagesReceived, getSession, getTPluginNames, hasListeners, incrementMessagesReceivedCount, isAutoConfirm, isValidating, removeListener, setTPEndpointName, suspend
getComponentRegistry, getName, getStatus, isActivated, remove
public MSubscriber(MComponentRegistry registry, java.lang.String name, MEndpointSpec endpointSpec, boolean autoConfirm) throws MException
MSubscriber
instance that uses an endpoint specification.
By default, the subscriber is inactive.
Note: If a subscriber is specified to be autocreated and active in the adapter instance description object, it will only become active if a listener has already been attached.
registry
- Component registry that holds this subscriber.name
- Name of this subscriber instance. Must be unique.endpointSpec
- The endpointSpec specification for this MSubscriber
. See MEndpointSpec
.
The timeout value for this subscriber is specified in the endpoint specification.
If the subscriber is activated and does not get an event within the specified
timeout period, it returns and dispatches a timeout event. If the subscriber
receives one (or more) events after activation but no additional events for
amounts of time exceeding the timeout, there is no timeout event.
Timeout is specified in milliseconds. Default is 0, that is, never time out.
If no destination is specified by the endpointSpec an inbox or temporary topic or temporary queue subscriber will be created.autoConfirm
- Specify whether event is confirmed automatically or explicitlyMException
- If any value in the endpointSpec specification is invalid.public MSubscriber(MApp app, java.lang.String name, MRvSession session, int protocol, int timeout) throws MException
Note: If a subscriber is specified to be autocreated and active in the adapter instance description object, it will only become active if a listener has already been attached.
Note: Applicable only for TIBCO Rendezvous transport.app
- Adapter application in which this subscriber is created.name
- Name of this subscriber instance. Must be unique.session
- Name of the session in which this MSubscriber
is to be created.protocol
- Communications protocol to be used by this subscriber. One of
the values defined by MCommProtocol
.timeout
- After the subscriber is activated, it waits for an event.
If the subscriber is activated and does not get an event within the specified
timeout period, it returns and dispatches a timeout event. If the subscriber
receives one (or more) events after activation but no additional events for
amounts of time exceeding the timeout, there is no timeout event.
This value is specified in milliseconds. Default is 0, that is, never time out.
MException
- if the protocol
parameter is invalid.public MSubscriber(MApp app, java.lang.String name, java.lang.String sessionName, int protocol, int timeout) throws MException
Note: If a subscriber is specified to be autocreated and active in the adapter instance description object, it will only become active if a listener has already been attached.
Note: Applicable only for TIBCO Rendezvous transport.app
- Adapter application in which this subscriber is created.name
- Name of this subscriber instance. Must be unique.sessionName
- Name of the session in which this MSubcriber
is to be created.protocol
- Communications protocol to be used by this subscriber. One of
the values defined by MCommProtocol
.timeout
- After the subscriber is activated, it waits for an event.
If the subscriber is activated and does not get an event within the specified
timeout period, it returns and dispatches a timeout event. If the subscriber
receives one (or more) events after activation but no additional events for
amounts of time exceeding the timeout, there is no timeout event.
This value is specified in milliseconds. Default is 0, that is, never time out.
MException
- if the protocol
parameter is invalid.MSubscriber(MApp, String, MRvSession, int, int)
public MSubscriber(MApp app, java.lang.String name, MRvSession session, int protocol, java.lang.String subject, int timeout) throws MException
MSubscriber
. By default, the subscriber is not active.
Note: Applicable only for TIBCO Rendezvous transport.app
- Adapter application in which this subscriber is created.name
- Name of this subscriber instance. Must be unique.session
- The session in which this MSubcriber
is to be created.protocol
- Communications protocol to be used by this subscriber.subject
- Destination name to be used by this subscriber.timeout
- The time limit before a timeout event occurs.MException
MSubscriber(MApp, String, MRvSession, int, int)
public MSubscriber(MApp app, java.lang.String name, java.lang.String sessionName, int protocol, java.lang.String subject, int timeout) throws MException
MSubscriber
. By default, the subscriber is not active.
Note: Applicable only for TIBCO Rendezvous transport.app
- Adapter application in which this subscriber is created.name
- Name of this subscriber instance. Must be unique.sessionName
- The name of the session in which this MSubcriber
is to be created.protocol
- Communications protocol to be used by this subscriber.subject
- Destination name to be used by this subscriber.timeout
- The time limit before a timeout event occurs.MException
MSubscriber(MApp, String, String , int, int)
public MApp getApp()
public long getTimeout()
A subscriber dispatches a timeout event if it has not received any event within the specified timeout value after it has been activated. If it receives one (or more) events after activation but no additional events for a time that exceeds the timeout, there is no timeout event.
The timeout is returned in milliseconds.
public void confirm(MDataEvent dataEvent) throws MException
MException
MDataEvent.confirm()
public MRvSession getMRvSession()
MSubscriberEventSource.getSession()
public int getDeliveryMode()
MEndpointSpec.DELIVERY_RELIABLE
MEndpointSpec.DELIVERY_PERSIST
MRvEndpointSpec.DELIVERY_DIST_Q
getDeliveryMode
in class MSubscriberEventSource
public int getProtocol()
getDeliveryMode()
public java.lang.String getSubjectName()
public void validateMessage(boolean doValidate)
public void setSubjectName(java.lang.String p_subject)
public void addAdvisoryListener(MEventListener p_listener)
protected void init(MComponentRegistry registry, MEndpointSpec endpointSpec, boolean isOwner, boolean autoConfirm) throws MException
init
in class MSubscriberEventSource
MException
protected void createImpl(MComponentRegistry registry, MEndpointSpec endpointSpec, boolean autoConfirm) throws MException
MException
public void notify(MEvent p_event)
MEventSource
notify
in class MEventSource
p_event
- Event to send to all attached listenerspublic java.util.Enumeration getClassNames()
public void addClassName(java.lang.String p_className)
public java.lang.Object getDestination()
public void noAutoConfirm() throws MException
confirm()
method to perform
explicit confirmation that the event is consumed.
The default behavior of certified listeners is to automatically confirm message delivery upon return from the data callback function. Programs can selectively override this behavior for specific listening endpoints (without affecting other listening endpoints).
By overriding automatic confirmation, the listener assumes responsibility for explicitly confirming each inbound certified message. Consider overriding automatic confirmation when processing inbound messages involves asynchronous activity, such as computations in other threads, database queries, or additional network communications.
noAutoConfirm
in class MSubscriberEventSource
MException
- on any error during the process of directing this
RVCM subscriber not to send confirmation automatically.