Hi Watt,

I personally think streams are a good fit to be used with processing
queues. The reasoning is that they apply and obey backpressure throughout
the entire pipeline you build providing good stability. On top of this, it
gives you a significant control about how you want to partition the
processing step into concurrent/parallel entities.

> Is it recommended to use Akka to do polling and getting the message off
the queue or just use MessageListener that comes with the queue lib?

Well, the ideal approach would be to have some API that has some
asynchronous pull support, i.e. you can ask for the next element and then
have a callback called once it becomes available. Push based interfaces,
that just call a callback on every arrival would defeat the purpose of
backpressure. Blocking pull, while not the nicest, is still acceptable
compromise for 3rd party APIs, but these should be isolated on a dedicated
dispatcher with a dedicated thread (this is also necessary if the library
relies on thread locals)

>  Is there any implication about thread safely and transactions across
threads between each approach?  Thanks for your help.

Any state that is wrapped in an actor or graph processing stage (as in,
they are hiding this from the external world, allowing modification only
through their exposed interfaces) will be safe as the actor model
implemented by Akka ensures proper serialized and memory safe access to
this state (see http://doc.akka.io/docs/akka/2.4.1/general/jmm.html).

The only tricky part is if some library uses ThreadLocals since actors are
executed over a thread-pool and therefore not guaranteed to be executed on
the same thread for subsequent invocations. This can be circumvented by
creating a pool of such actor that wrap the ThreadLocal based API, and then
assign these to a PinnedDispatcher which will dedicate a thread for each of
the actors in this pool.

-Endre

On Thu, Jan 21, 2016 at 1:22 PM, Watt Poosanguansit <
[email protected]> wrote:

> Hi,
>
> I do have a general question about pro and cons in using Akka and Akka
> stream in processing queues.  I do have IBM JMS queue that I need to
> process.  Is it recommended to use Akka to do polling and getting the
> message off the queue or just use MessageListener that comes with the queue
> lib?  Is there any implication about thread safely and transactions across
> threads between each approach?  Thanks for your help.
>
>
>
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Akka Team
Typesafe - Reactive apps on the JVM
Blog: letitcrash.com
Twitter: @akkateam

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to