You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by Anthony <an...@rmb.co.za> on 2007/01/12 12:28:22 UTC

Singleton Service/Endpoint?

Hi guys,

I wrote a service engine that works much the same way as servicemix-eip's
split-aggregator but it contains some other functionality that's specific to
our environment for e.g.:
- aggregation is created (per custom generated session ID) when a "start
aggregation" arrives & aggregates when a "stop aggregation" message arrives
- we persist our aggregations in various persistence stores (memory, jms,
database) depending on the system involved
- etc

An example usage would be:
1. "start aggregation" message with session ID 1 arrives on input endpoint,
aggregation is created
2. "content" for session ID 1 arrives on input endpoint, is added to
previous aggregation
3. "content" for session ID 1 arrives on input endpoint, is added to
previous aggregation
4. "content" for session ID 1 arrives on input endpoint, is added to
previous aggregation
5. "stop aggregation" message for session ID 1 arrives on input endpoint,
aggregation finishes and result is put on output endpoint

I just pumped 2000 messages through to my input endpoint and it looks like
multiple instances of this service engine/assembly is launched for the input
messages (like some sort of thread pooling). The messages are then being
processed not in the order that I sent them from my test class, causing
exceptions. This happens because for example a "content" messages gets
processed before its "start aggregation" message got processed thus throwing
my SessionNotFound exception because the session has not been created yet...

Do any of you know how I can make this service engine/unit to be a Singleton
/ only 1 thread run at a time, thus causing my messages to be processed in
the order that they arrive on my input endpoint? Can you just configure this
in one of the XML configuration files like you can in Spring?

(I'm running this in FUSE version 1.2.1)

Please help!

Many thanks!
Anthony
-- 
View this message in context: http://www.nabble.com/Singleton-Service-Endpoint--tf2965466s12049.html#a8296840
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.


Re: Singleton Service/Endpoint?

Posted by Anthony <an...@rmb.co.za>.
is there a configurable mechanish to ensure First In First Out endpoint
listening/processing? or do i have to build all this myself?


gnodet wrote:
> 
> There is usually only one instance which process all the messages
> concurrently, so if you process them in a synchronized method,
> only one message will be processed at one time.  This does not
> really ensure ordering however.
> 
> On 1/12/07, Anthony <an...@rmb.co.za> wrote:
>>
>> Hi guys,
>>
>> I wrote a service engine that works much the same way as servicemix-eip's
>> split-aggregator but it contains some other functionality that's specific
>> to
>> our environment for e.g.:
>> - aggregation is created (per custom generated session ID) when a "start
>> aggregation" arrives & aggregates when a "stop aggregation" message
>> arrives
>> - we persist our aggregations in various persistence stores (memory, jms,
>> database) depending on the system involved
>> - etc
>>
>> An example usage would be:
>> 1. "start aggregation" message with session ID 1 arrives on input
>> endpoint,
>> aggregation is created
>> 2. "content" for session ID 1 arrives on input endpoint, is added to
>> previous aggregation
>> 3. "content" for session ID 1 arrives on input endpoint, is added to
>> previous aggregation
>> 4. "content" for session ID 1 arrives on input endpoint, is added to
>> previous aggregation
>> 5. "stop aggregation" message for session ID 1 arrives on input endpoint,
>> aggregation finishes and result is put on output endpoint
>>
>> I just pumped 2000 messages through to my input endpoint and it looks
>> like
>> multiple instances of this service engine/assembly is launched for the
>> input
>> messages (like some sort of thread pooling). The messages are then being
>> processed not in the order that I sent them from my test class, causing
>> exceptions. This happens because for example a "content" messages gets
>> processed before its "start aggregation" message got processed thus
>> throwing
>> my SessionNotFound exception because the session has not been created
>> yet...
>>
>> Do any of you know how I can make this service engine/unit to be a
>> Singleton
>> / only 1 thread run at a time, thus causing my messages to be processed
>> in
>> the order that they arrive on my input endpoint? Can you just configure
>> this
>> in one of the XML configuration files like you can in Spring?
>>
>> (I'm running this in FUSE version 1.2.1)
>>
>> Please help!
>>
>> Many thanks!
>> Anthony
>> --
>> View this message in context:
>> http://www.nabble.com/Singleton-Service-Endpoint--tf2965466s12049.html#a8296840
>> Sent from the ServiceMix - Dev mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Architect, LogicBlaze (http://www.logicblaze.com/)
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Singleton-Service-Endpoint--tf2965466s12049.html#a8360506
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.


Re: Singleton Service/Endpoint?

Posted by Guillaume Nodet <gn...@gmail.com>.
There is usually only one instance which process all the messages
concurrently, so if you process them in a synchronized method,
only one message will be processed at one time.  This does not
really ensure ordering however.

On 1/12/07, Anthony <an...@rmb.co.za> wrote:
>
> Hi guys,
>
> I wrote a service engine that works much the same way as servicemix-eip's
> split-aggregator but it contains some other functionality that's specific to
> our environment for e.g.:
> - aggregation is created (per custom generated session ID) when a "start
> aggregation" arrives & aggregates when a "stop aggregation" message arrives
> - we persist our aggregations in various persistence stores (memory, jms,
> database) depending on the system involved
> - etc
>
> An example usage would be:
> 1. "start aggregation" message with session ID 1 arrives on input endpoint,
> aggregation is created
> 2. "content" for session ID 1 arrives on input endpoint, is added to
> previous aggregation
> 3. "content" for session ID 1 arrives on input endpoint, is added to
> previous aggregation
> 4. "content" for session ID 1 arrives on input endpoint, is added to
> previous aggregation
> 5. "stop aggregation" message for session ID 1 arrives on input endpoint,
> aggregation finishes and result is put on output endpoint
>
> I just pumped 2000 messages through to my input endpoint and it looks like
> multiple instances of this service engine/assembly is launched for the input
> messages (like some sort of thread pooling). The messages are then being
> processed not in the order that I sent them from my test class, causing
> exceptions. This happens because for example a "content" messages gets
> processed before its "start aggregation" message got processed thus throwing
> my SessionNotFound exception because the session has not been created yet...
>
> Do any of you know how I can make this service engine/unit to be a Singleton
> / only 1 thread run at a time, thus causing my messages to be processed in
> the order that they arrive on my input endpoint? Can you just configure this
> in one of the XML configuration files like you can in Spring?
>
> (I'm running this in FUSE version 1.2.1)
>
> Please help!
>
> Many thanks!
> Anthony
> --
> View this message in context: http://www.nabble.com/Singleton-Service-Endpoint--tf2965466s12049.html#a8296840
> Sent from the ServiceMix - Dev mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Architect, LogicBlaze (http://www.logicblaze.com/)
Blog: http://gnodet.blogspot.com/