Chronicle-Network: How to send a message asynchronously on a acceptor

139 views
Skip to first unread message

maxim...@gmail.com

unread,
Oct 23, 2015, 8:50:07 AM10/23/15
to Chronicle
Hi,

I want to use Chronicle-Network to create a basic FIX server to testing purpose.
I use Chronicle-Network because I need it to have the better performance (Low Latency).

I have read documentation/example and I create my own server (AcceptorEventHandler) without Chronicle-Wire (direct TcpHandler implementation).

I succeed to read FIX Messages (thanks to SAXophone)  but I want to write FIX message asynchronously.
To my understanding, the only way to write messages is to use "Bytes out" on "net.openhft.chronicle.network.api.TcpHandler":

public void process(Bytes in, Bytes out, SessionDetailsProvider sessionDetails) {

In my usage, I need to send messages/bytes outside of this method.
I check source code but I did not find a way to send bytes on the SocketChannel created by AcceptorEventHandler.
I mean that I have no access to SocketChannel objects.

Could you explain how to directly send messages to SocketChannels created by AcceptorEventHandler?

Regards,

Maxime

Rob Austin

unread,
Oct 23, 2015, 8:53:28 AM10/23/15
to java-ch...@googlegroups.com, Peter Lawrey, Daniel Shaya
Maxime

We have an enterprise product that ( should do ) what you want, would you be interested in having further discussions about this 

Rob
 
--
You received this message because you are subscribed to the Google Groups "Chronicle" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-chronicl...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Peter Lawrey

unread,
Oct 23, 2015, 9:05:45 AM10/23/15
to java-ch...@googlegroups.com
Hello Maxime,
   What is the problem with writing to the Bytes buffer instead of the SocketChannel? You will need to use a ByteBuffer either way, the only limitation is you have to use the one provided.

Regards,
   Peter.

--

maxim...@gmail.com

unread,
Oct 23, 2015, 11:00:43 AM10/23/15
to Chronicle
Hi,

I copy "Bytes out" on "TcpHandler" "process" method to another Object to keep a reference on it:

public void process(Bytes in, Bytes out, SessionDetailsProvider sessionDetails) {

And when I want to write messages asynchronously, I do :

out.write(bytes)

But it does not write anything on socket.
When I debug my application on "TcpEventHandler" I see that "outBBB" is correctly filled, but this is only "outBB" that is written on  "WriteEventHandler".

I am not familiar with ByteBuffer, so I am sure I am doing "bad things" but I do not understand my error.

Rob, for Enterprise product (Chronicle-FIX I guess) I have to check with my company (Top-Managers) to see if we can buy Enterprise Licence. 
But I will be pleased to test it :-)
To be honest, as the "Decision Center" is based on USA (big world-wide company), I do not know the exact policy about library licensing, but I will ask about it.

Regards,

Maxime

maxim...@gmail.com

unread,
Nov 20, 2015, 11:56:18 AM11/20/15
to Chronicle
Hi,

Sorry to annoying you (again) with that, but could you help me with Chronicle-Network?
Here is my issue:

I copy "Bytes out" on "TcpHandler" "process" method to another Object to keep a reference on it:

public void process(Bytes in, Bytes out, SessionDetailsProvider sessionDetails) {

And when I want to write messages asynchronously, I do :

out.write(bytes)

But it does not write anything on socket.
When I debug my application on "TcpEventHandler" I see that "outBBB" is correctly filled, but this is only "outBB" that is written on  "WriteEventHandler".

I am not familiar with ByteBuffer, so I am sure I am doing "bad things" but I do not understand my error.

Regards,

Maxime

Rob Austin

unread,
Nov 20, 2015, 12:30:34 PM11/20/15
to java-ch...@googlegroups.com
if you wanted to copy to a byte array 
this.copyTo(new byte[(int)this.readRemaining()]);
Tob

Rob Austin

unread,
Nov 20, 2015, 12:38:53 PM11/20/15
to java-ch...@googlegroups.com
or rather

out.copyTo(new byte[(int)this.readRemaining()]);

maxim...@gmail.com

unread,
Dec 1, 2015, 6:09:14 AM12/1/15
to Chronicle
Hi,

There is a misunderstanding here, I want to write asynchronously on "net.openhft.chronicle.network.api.TcpHandler".

Indeed, I create a server with "net.openhft.chronicle.network.AcceptorEventHandler" that accepts "TcpHandler".
When I receive a message on "public void process(Bytes in, Bytes out, SessionDetailsProvider sessionDetails)" I read the message thanks to "Bytes in" and I transfer this message to another thread.
This other thread after some processing want to send a message on the same socket.
I am blocked on this point because I do not succeed to send this message, 
I try to save the "Bytes out" from last "process" function called to read, but it did not work.

Have you an example of this kind of code?

Regards,

Maxime
Reply all
Reply to author
Forward
0 new messages