Push Consumers behave as if they were single-threaded, processing only one even at a time, why?

From Support
Jump to: navigation, search

Question:

Push Consumers behave as if they were single-threaded, processing only one event at a time!

Answer:

The Proxy Push Supplier in an Event Channel runs in a single thread. The push() call to the consumer is two-way so the next event can not be sent until the processing of the event in the consumer has completed.

The Event Channel was designed this way for three reasons:
1) The overhead of spawning a thread for each event being sent to each Consumer could become unreasonable in many applications
2) Many applications for the Event Service expect the Consumer to process events in the same order that they were sent. Allowing multi-threading within the Proxy Push Supplier would make it impossible to ensure the order of processing for events.
3) The Event Channel can potentially send events much faster than a Consumer can process them, which would result in less reliability.

Spawn a thread in the push() implementation of the Push Consumer to handle any processing that may take awhile and for which the order in which events are processed is not important.

or

Load an interceptor in the Event Channel that will spawn a new thread to process remote push() invocations.



Article originally contributed by Borland Developer Support