Open topic with navigation

# Event Queue and Message Dispatch

After a subscriber distributes a message to an event queue, the message is ready for processing. But processing does not occur until after the program explicitly dispatches the message from the event queue. Event queues have no analogue in TIBCO EMS.

## Event Queue as a Separation

An event queue is like a transfer station for messages.

- A subscriber object shepherds a message through the first three phases of delivery, from the transport to the event queue.
- Thereafter, the application program shepherds the program through the last three phases of delivery, dispatching it from the event queue, processing it, and releasing it.

Between these two shepherds, a message makes a brief stop on an event queue.

A program that creates subscriber objects must also create at lest one event queue. The program must add each subscriber to an event queue.

## Message Events

More precisely, a message event makes a brief stop on an event queue. A message event is a package that includes a message, the appropriate callback method to process the message, and all the arguments that the callback method requires. (This level precision is not important for developers. It is more common to say that the event queue contains messages, even though it actually contains message events.)

## Dispatch

The dispatch call removes a message event from an event queue, and invokes the callback method on the message.

Application programs arrange a dispatch thread running a loop that dispatches messages.

It is good practice to dispatch each event queue using at least one dispatch thread. You can even dispatch a queue using several concurrent threads, unless concurrent processing of messages would yield incorrect application semantics.

## Key Points for Developers

- A program creates an event queue.
- A program associates each subscriber with one event queue and one message processing callback.
- A program dispatches message events from the event queue for processing.
- Use a dispatch loop to repeatedly dispatch messages.
- You may start several dispatch loops in separate threads to take advantage of multi-core processors.

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 FTL® - Enterprise Edition

Copyright © 2009-2024. Cloud Software Group, Inc. All Rights Reserved.