Hello All,

After being directed towards the Proton-J reactor (away from the messenger), I 
have been experimenting with reactor. I modified the supplied reactor examples 
to send/recv to/from a queue on HornetQ fairly quickly.

However, I appear to be having less success implementing a heartbeat/keep-alive 
(HornetQ 2.4.0 will disconnect after a one minute default if it does not 
receive data from the client). 

I have scheduled a regular event using [ e.getReactor().schedule(10000, this); 
] with a view to implementing a heartbeat. I then override onTimerTask() and 
call tick() or send an empty frame within onTimerTask() then re-schedule 
another call of onTimerTask() -- I have tried several permutations. 

However, whether I use tick(), or send an empty frame, it does not seem to 
maintain the connection.

I was wondering:
1) Are there any better approaches?
2) What is the "correct" approach/location for using tick()?

Thank you & regards,
Matthew



-----Original Message-----
From: Robbie Gemmell [mailto:robbie.gemm...@gmail.com] 
Sent: 18 March 2016 17:59
To: users@qpid.apache.org
Subject: Re: Rapid generation of IOExceptions on Proton-J client recv() when 
HornetQ stopped/becomes unavailable

On 18 March 2016 at 12:15, Matthew Karlsen <mkarl...@idbs.com> wrote:
> Hello All,
>
> We have a queue running in HornetQ 2.4.0 (embedded within Wildfly), with a 
> Proton-J 0.12.0 client periodically connecting to this queue.
>
> If HornetQ stops or becomes unavailable when the Proton-J client is running, 
> the Proton-J client continually generates exceptions similar to that below 
> (very rapidly).
>
> The issue is that the IOException generated exception is handled in 
> MessengerImpl's processActive() by generating an "Error processing 
> connection" message in the logs, rather than recv() throwing an exception and 
> hence the higher level program logic is unable to react to the problem.
>
> Is this a bug or am I missing something important?
>
> Thank you,
> Matthew
>
> java.io.IOException: An existing connection was forcibly closed by the remote 
> host
>         at sun.nio.ch.SocketDispatcher.read0(Native Method)
>         at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
>         at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
>         at sun.nio.ch.IOUtil.read(IOUtil.java:197)
>         at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
>         at 
> org.apache.qpid.proton.driver.impl.ConnectorImpl.read(ConnectorImpl.java:129)
>         at 
> org.apache.qpid.proton.driver.impl.ConnectorImpl.process(ConnectorImpl.java:94)
>         at 
> org.apache.qpid.proton.messenger.impl.MessengerImpl.processActive(MessengerImpl.java:738)
>         at 
> org.apache.qpid.proton.messenger.impl.MessengerImpl.waitUntil(MessengerImpl.java:895)
>         at 
> org.apache.qpid.proton.messenger.impl.MessengerImpl.waitUntil(MessengerImpl.java:844)
>         at 
> org.apache.qpid.proton.messenger.impl.MessengerImpl.recv(MessengerImpl.java:446)
>         at 
> org.apache.qpid.proton.messenger.impl.MessengerImpl.recv(MessengerImpl.java:451)
>         ...
>         at java.lang.Thread.run(Thread.java:745)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org For 
> additional commands, e-mail: users-h...@qpid.apache.org
>

Hi Matthew,

It certainly doesnt seem desirable, I'd guess its a bug, though someone 
actually familiar with Messenger could certainly correct me on that.

Messenger isn't widely used on the proton-j side, and in general Messenger 
isn't getting much developer attention these days (arguably never did in 
proton-j, which is mostly still used as an pure protocol engine as intended at 
the outset) since folks are concentrated more on newer reactive APIs.

Proton-J is a bit behind the curve in terms of the higher level reactive work 
being/already done in some of the other lanaguages (something I'll be looking 
to get to), but there was a Java port done of the 'reactor' that exists in 
proton-c and some of its bindings. I'm not particularly familiar with it 
either, or how it would handle this situation, but it may be worth you looking 
at as alternative to Messenger. You can see some example of it in the 
examples/java/reactor dir, e.g. the Send class (the Recv class in this case is 
actually a server/listener that accepts incoming connections, such as those 
made by Send).

Robbie

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org For additional 
commands, e-mail: users-h...@qpid.apache.org

Reply via email to