Open topic with navigation

TIBCO Rendezvous® 8.7.0

# Listener

Class

## Superclasses

    System.Object
      Listener

## Visual Basic

    Public Class Listener

## C#

    public class Listener

## Purpose

Listen for inbound messages.

## Remarks

Each Listener object represents your program’s interest in a set of message events. When a matching message arrives, TIBCO Rendezvous places the message in the listener’s queue. Dispatch removes the first message from the queue, and raises a MessageReceived event. .NET calls the event handler delegates associated with the listener to process the message.

A listener object continues listening for messages until the program destroys it. The method Listener.Destroy destroys a listener explicitly, immediately canceling interest in messages. You can also destroy a listener implicitly by deleting all references to it, but the garbage collector might introduce a delay before it destroys the object and cancels interest.

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

Method | Description | Page
## Constructor
Listener | Create a listener object to listen for inbound messages. | Listener
Listener.Destroy | Destroy a listener, canceling interest. | Listener.Destroy

Member | Description |
## Public Instance Properties
``Queue`` | Queue The listener’s event queue. | Get
``Subject`` | ``string`` The listener expresses interest in this subject, and receives messages with matching destination subjects. | Get
``Transport`` | Transport The listener receives inbound messages from this transport. | Get
## Public Events
``MessageReceived`` | MessageReceivedEventHandler An inbound message arrived.

## Activation and Dispatch

Inbound messages on the transport that match the subject trigger the listener; dispatch raises a MessageReceived event.

The constructor creates a listener 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 message on the listener’s event queue. Dispatch removes the message from the queue, and raises a MessageReceived event; .NET runs the handler delegates to process the message. (To stop receiving inbound messages on the subject, destroy the listener object; this action cancels all messages already queued for the listener; see also Listener.Destroy.)

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

Figure 248: Listener Activation and Dispatch

When the callback method is I/O-bound, messages can arrive faster than the callback delegate 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

VectorListener

CMListener

Subtopics

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO Rendezvous®

Copyright © 1997-2023. Cloud Software Group, Inc. All Rights Reserved.