TibrvListener

Class

Declaration

class com.tibco.tibrv.TibrvListener
  extends TibrvEvent

Purpose

Listen for inbound messages.

Remarks

A listener object continues listening for messages until the program destroys it.

Programs must destroy instances of this class. Rendezvous software keeps internal references to these objects, so the Java garbage collector does not delete them automatically.

Destroying the queue or transport of an event automatically destroys the listener as well.

Method

Description

TibrvListener()

Create a listener object to listen for inbound messages.

TibrvListener.getSubject()

Extract the subject from a listener event object.

TibrvListener.getTransport()

Extract the transport from a listener event object.

Inherited Methods

TibrvEvent.destroy()

TibrvEvent.getClosure()

TibrvEvent.getQueue()

TibrvEvent.isValid()

java.lang.Object.equals

java.lang.Object.getClass

java.lang.Object.hashCode

java.lang.Object.notify

java.lang.Object.notifyAll

java.lang.Object.toString (override)

java.lang.Object.wait

Activation and Dispatch

Inbound messages on the transport that match the subject trigger the event.

This constructor creates a listener event object, and activates the event—that is, it begins listening for all inbound messages with matching subjects. When a message arrives, Rendezvous software places the event object and message on its event queue. Dispatch removes the event object from the queue, and runs the callback method to process the message. (To stop receiving inbound messages on the subject, destroy the event object; this action cancels all messages already queued for the listener event; see also TibrvEvent.destroy().)

Listener Activation and Dispatch illustrates that messages can continue to accumulate in the queue, even while the callback method is processing.

Figure 238: Listener Activation and Dispatch

When the callback method is I/O-bound, messages can arrive faster than the callback method can process them, and the queue can grow unacceptably long. In programs where a delay in processing messages is unacceptable, consider dispatching from several threads to process messages concurrently.

Descendants

TibrvVectorListener

TibrvCmListener