Read this if you haven't
https://doc.akka.io/docs/akka/2.5/scala/dispatchers.html#blocking-needs-careful-management

You can start with a single Actor for JMS and one for file IO, each
configured with a custom dispatcher.
Or use Futures, with custom dispatchers provided as ExecutionContext.

On Mon, Oct 16, 2017 at 8:30 AM, Dries Demeurisse <
[email protected]> wrote:

> Hi,
>
> We are doing a lot of blocking operations: file reading + synchronous JMS
> sending. (Currently not really possible to make use of the async
> alternatives)
> Events come in: for each event, 1-x files are read and parsed until an
> end-event comes in, meanwhile the results are sent to an activeMQ.
> There can be a multitude of these running simultaneous, currently each
> file is 1 actor.
>
> The problem that I've been trying to wrap my head around concerning
> JMS/doing blocking I/O is: (to be clear: just using JmsTemplate for sending
> to JMS)
> - should I go with #xxx actors (1 per file-actor) that send to JMS
> (created on a 'blocking-io-dispatcher')
> - or should I create some sort of pool of 4-x actors that will do the JMS
> work
> - or just 1 actor that only sends to JMS (what if it crashes? can imagine
> some supervision problems)
> - or shouldn't I have seperate actor(s) for JMS and just handle it in a
> future?
> - or work with the Akka Camel integration
> (Alpakka Streaming won't go as it only supports String messages at the
> moment and the legacy code is using JMSObject messages. And even there you
> have the same problem: how many producers do you want to have streaming to
> MQ? + I want to send synchronous via JMS at the moment, because I fear
> randomly losing messages)
>
>
> With the file reading it is about the same problem: it's an internal
> library that does old school java IO with BufferedReaders, so no async
> handling there too:
> - should I create "blocking" actors: just do the I/O and block the actor
> - or should I do the file I/O in futures and send outcome messages to
> myself (or the JMS actor)
>
> Finally the combination: can they both be on the same
> blocking-io-dispatcher or should JMS and File I/O each have their own
> blocking dispatcher? :-)
>
> I suspect Akka may not have been the ideal framework for this sort of
> task, but that was out of my hands (inherited). I just want to use it as
> best as I can.
>
> So, can you provide some advice or maybe things I overlooked or am I just
> overcomplicating things?
>
> Thanks!
>
> --
> >>>>>>>>>> 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.
>

-- 
>>>>>>>>>>      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