-
1. Re: hornetq netty
timfox Sep 20, 2010 4:59 AM (in response to mariateresa)I'm not sure what you're trying to do here, but it sounds like you want to create your own client?
If so, why don't you just use the HornetQ client? It would be a lot easier.
-
2. Re: hornetq netty
mariateresa Sep 20, 2010 11:44 AM (in response to timfox)What I have to do is develop a server component deployed into an application server that accepts simple TCP/IP socket connections from clients.
This clients need to connect to a JEE server, they have to do with legacy clients and cannot be changed.
I've done this before with a simple listener and starting threads (server socket) in the server but I wanted to follow a standards oriented approach for a new development.So I decided to use a JCA resource adapter to solve this scenario.
Java Connector Architecture 1.5 and EJB Message Driven Beans combine to allow new server components to be deployed within application servers in a portable and standardized way.
With JCA developers are able to extend the services offered by the application server to any protocol or technology and the application server is truly extensible.
(See http://www.theserverside.com/news/1364656/Serve-It-Up-with-J2EE-14-Use-JCA-15-and-EJB-21-to-Extend-your-App-Server for more details).
Then when I saw hornetq's documentation I thought that it would helps me simplify matters.
I thounght that hornetq acceptor could listens over an IP and port, and it could receive tcp message through netty.
Do you get my point?
I can say more if you need
Thanks in advance and sorry for my english.
-
3. Re: hornetq netty
timfox Sep 20, 2010 11:54 AM (in response to mariateresa)I don't really see how this relates to a messaging system like HornetQ.
-
4. Re: hornetq netty
mariateresa Sep 20, 2010 12:50 PM (in response to timfox)Ok, so if hornetq cannot help me to accept socket message, it could help me to control the message flow once it's arrived on the server.
So, once I have my custom message on a MDB as shown below
public interface LtmTerminalMessageListener {void onMessage(LtmTerminalMessage msg);}______________________________________________
public interface MyMessageListener {
void onMessage(MyMessage msg);
}______________________________________________
public interface MyMessage {
InetSocketAddress getInetSocketAddress();
ByteBuffer getInputData();
void setOutputData(ByteBuffer[] byteBuffer);
long getReceivedTime();
}______________________________________________
public class TisMDB implements MessageDrivenBean, LtmTerminalMessageListener {
...public void onMessage(MyMessage msg) {
log.info("Got MyMessage: " + msg);
byte[] temp1 = getInputPacket(msg.getInputData().array());
//PUBLISH THE MESSAGE TO RELATIVE ADDRESS AFTER READING HEADER
ByteBuffer bb = ByteBuffer.wrap(temp1);
msg.setOutputData(new ByteBuffer[] { bb });
}
...
______________________________________________
I could divert and split message for example based on his header.
I have a sequence of services that I have to call if some flags are present on the header (e.g. gzip, crypting ..) , so I have to divert messages.
I must handle many thousand of messages per second.
Thanks.
-
5. Re: hornetq netty
ataylor Sep 21, 2010 3:09 AM (in response to mariateresa)Ok,
so if this is what you want to do you need to write your own JCA adaptor, this does not really have anything to do with HornetQ you should read the JCA spec (good luck) and read the JCA forums on how best to implement this. what you do in your JCA adaptor when you read your data from the buffer is up to you, you could wrap it up in a JMS and forward it to an endpoint(mdb) or something else, this is up to you. You could look at the HornetQ RA for some hints and tips and tp see what API to implement but like Tim says, its not really a problem that can be solved withHornetQ.
good luck
-
6. Re: hornetq netty
mariateresa Sep 21, 2010 5:21 AM (in response to ataylor)I had already implemented my JCA resource adaptor to solve this scenario, as above.
What I would to know now is if the idea of handle the message flow with hornetq is good or not for my use case, after messages arrived on MDB.
public void onMessage(MyMessage msg) {
log.info("Got MyMessage: " + msg);
byte[] temp1 = getInputPacket(msg.getInputData().array());
//PUBLISH THE MESSAGE TO RELATIVE ADDRESS AFTER READING HEADER
ByteBuffer bb = ByteBuffer.wrap(temp1);
msg.setOutputData(new ByteBuffer[] { bb });
}
At the beginning the concept of acceptor combined with netty was not so clear for me, I thought that the use of acceptors could help me to comunicate with TCP socket client.
Now is clear.
Thanks.