Re: data push
You can see JMS and joram (http://joram.objectweb.org/) Note : Joram is embedded in Jonas (http://jonas.objectweb.org/) and Tomcat too... On Thu, 11 Aug 2005 11:41:34 +0100 Darryl L. Miles [EMAIL PROTECTED] wrote: Paul Wallace wrote: Thanks Len, And what of other protocols? Are sockets then required? What are some other protocols that might be used to push/pull data? (off Tomcat I know ;)) Paul. I'm interested in the answer to this too. What terms do I stick into google to find generic socket based communication systems between isolated JVMs ? Protocols, Frameworks, something that will slot in with TC but not as raw as HTTP I want the API to be a POJO as possible but with a open / setup / work / close cycle. Idealy I'm really after a multiplexing (read as single socket) messaging framework that can deliver command / event like objects to a remote JVM for processing then return the appropiate reponse object and have multiple events outstanding all in different states with any sized payload. -- Darryl L. Miles - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: data push
Sounds like you are wanting to use the J2EE web services. Probably SOAP. Lionel Farbos wrote: You can see JMS and joram (http://joram.objectweb.org/) Note : Joram is embedded in Jonas (http://jonas.objectweb.org/) and Tomcat too... On Thu, 11 Aug 2005 11:41:34 +0100 Darryl L. Miles [EMAIL PROTECTED] wrote: Paul Wallace wrote: Thanks Len, And what of other protocols? Are sockets then required? What are some other protocols that might be used to push/pull data? (off Tomcat I know ;)) Paul. I'm interested in the answer to this too. What terms do I stick into google to find generic socket based communication systems between isolated JVMs ? Protocols, Frameworks, something that will slot in with TC but not as raw as HTTP I want the API to be a POJO as possible but with a open / setup / work / close cycle. Idealy I'm really after a multiplexing (read as single socket) messaging framework that can deliver command / event like objects to a remote JVM for processing then return the appropiate reponse object and have multiple events outstanding all in different states with any sized payload. -- Darryl L. Miles - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Brian Cook Digital Services Analyst Print Time Inc. [EMAIL PROTECTED] 913.345.8900 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: data push
Patrick Thomas wrote: Your remark about POJOs being part of the API prompted me to chime in -- William pretty much gave you the general answer, that Tomcat doesn't seem to be the best way to go for this (because everything is passed via http). Maybe HTTP is the transport protocol for a messaging framework that runs on top. I don't know enough about all the different intra-JVM mechanisms I've head of CORBA, RMI over IIOP, EJB Remote, XML-RPC, and a dozen more related protocols. Some are too raw or not a framework, some cover multiple levels of the same problem. A more featureful Application Server (like JBoss) can already do EJB Local/Remote call design patterns out of the box, I don't (think I) need JBoss and everything it is. I suppose what throwing in the air is the question: Is there a web resource that details each of the common intra-JVM communication mechanisms thats in place for their pro's con's, everything from memory consumption, runtime speed, security policies, programming interface, easy of setting up how to future proof remotable API usage so it remains compatible and extensible at the same time. Then what contracts does each of these mechanisms provide to the applications that use them. HTTP could be a big part of a push or pull data mechanism or it maybe implemented outside of HTTP with raw sockets and another wire protocol, in this case it would be a JAR file that sides outside of tomcat itself and my application which is running in the same JVM as TC would use it independatly of TC. Your serializing objects idea is a little too raw for my use, I'm looking for something with a more reliable contract and wider community testing than a roll your own TCPIP stack approach. -- Darryl L. Miles - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: data push
Paul Wallace wrote: Thanks Len, And what of other protocols? Are sockets then required? What are some other protocols that might be used to push/pull data? (off Tomcat I know ;)) Paul. I'm interested in the answer to this too. What terms do I stick into google to find generic socket based communication systems between isolated JVMs ? Protocols, Frameworks, something that will slot in with TC but not as raw as HTTP I want the API to be a POJO as possible but with a open / setup / work / close cycle. Idealy I'm really after a multiplexing (read as single socket) messaging framework that can deliver command / event like objects to a remote JVM for processing then return the appropiate reponse object and have multiple events outstanding all in different states with any sized payload. -- Darryl L. Miles - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: data push
From: Paul Wallace [EMAIL PROTECTED] Sent: Wednesday, August 10, 2005 6:38 PM Hi and thanks for that, That's the crux of my question! The data (I am unsure of the protocol it is delivered in) is sent at random points in time i.e not from any request. I wish to create particularly the client (server B) that listens for this data. I (mistakenly) mentioned server A to mimic the data pushes. I can write something to fire off data at intermittent times, but I am more interested in how to capture that data, when no request has been made. This is the reason why I first questioned on Sockets. Perhaps I should have been clearer from the off! Yea, that protocol detail is kind of important. As others have said, Tomcat is set up for HTTP requests, and pretty much ONLY HTTP requests. As much as it would be nice to extend GenericServlet to work with ANY protocol, in truth it just doesn't happen and is not really practical. The GenericServlet interface is still pretty heavily tainted by HTTP. If you want to listen to HTTP datastreams, then Tomcat is the hot tip. If not, then you can start with the Jakarta Avalon project (which is basically dead). Avalon was a lower level container designed to be the boiler plate so you can focus on implementing your own protocols. While the actual Avalon project is dead, the current project page shows you how it has forked into several other projects, so you can use that as a starting point to perhaps hunt down a framework to more easily handle your own protocol. Now, to be fair, if you don't have any real VOLUME of data (lots of connections, high load, vs just the occasional chit-chat), you may well be able to write a simple server in just plain Java. A simple server is not difficult, and there are no doubt several examples on the net. Listening to a socket is no longer the rocket science it once was. Just depends on your tolerance for getting it to work vs learning a framework. Finally, if you REALLY want to dig in to the Tomcat internals, you can break it into little pieces and bits and hammer to fit to support your protocol. Also, there's the book How Tomcat Works which is actually a pretty good book if you want to know how to write a network server in Java. Regards, Will Hartung ([EMAIL PROTECTED]) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: data push
Darryl, Your remark about POJOs being part of the API prompted me to chime in -- William pretty much gave you the general answer, that Tomcat doesn't seem to be the best way to go for this (because everything is passed via http). I would point out that just as you can serialize/stream objects to disk and read them back again, you can do the same over network sockets -- in fact the code is nearly identical. So you can load up an object with all sorts of instance data on this end, open a socket connection to some other listening server (not tomcat, just a raw listener -- but that's only maybe 100 lines of code) and write(...) the object to the stream, then read it out on the other end. The serializing/deserializing concept of java will automagically reconstitute the object on the receiving end. (Assuming they both have access to the class at runtime). I seem to recall there being a very nice tutorial for java sockets on the sun java website; you could probably work up the basic communication in under an hour. Good Luck, Patrick On 8/11/05, Will Hartung [EMAIL PROTECTED] wrote: From: Paul Wallace [EMAIL PROTECTED] Sent: Wednesday, August 10, 2005 6:38 PM Hi and thanks for that, That's the crux of my question! The data (I am unsure of the protocol it is delivered in) is sent at random points in time i.e not from any request. I wish to create particularly the client (server B) that listens for this data. I (mistakenly) mentioned server A to mimic the data pushes. I can write something to fire off data at intermittent times, but I am more interested in how to capture that data, when no request has been made. This is the reason why I first questioned on Sockets. Perhaps I should have been clearer from the off! Yea, that protocol detail is kind of important. As others have said, Tomcat is set up for HTTP requests, and pretty much ONLY HTTP requests. As much as it would be nice to extend GenericServlet to work with ANY protocol, in truth it just doesn't happen and is not really practical. The GenericServlet interface is still pretty heavily tainted by HTTP. If you want to listen to HTTP datastreams, then Tomcat is the hot tip. If not, then you can start with the Jakarta Avalon project (which is basically dead). Avalon was a lower level container designed to be the boiler plate so you can focus on implementing your own protocols. While the actual Avalon project is dead, the current project page shows you how it has forked into several other projects, so you can use that as a starting point to perhaps hunt down a framework to more easily handle your own protocol. Now, to be fair, if you don't have any real VOLUME of data (lots of connections, high load, vs just the occasional chit-chat), you may well be able to write a simple server in just plain Java. A simple server is not difficult, and there are no doubt several examples on the net. Listening to a socket is no longer the rocket science it once was. Just depends on your tolerance for getting it to work vs learning a framework. Finally, if you REALLY want to dig in to the Tomcat internals, you can break it into little pieces and bits and hammer to fit to support your protocol. Also, there's the book How Tomcat Works which is actually a pretty good book if you want to know how to write a network server in Java. Regards, Will Hartung ([EMAIL PROTECTED]) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: data push
Paul Wallace wrote: Hi All, I would like server A (TC 5.5) to 'push' streams of data to server B (TC 5.5) at random points in time, and for server B to accept the data when it is received. This is not using request / response, hence I am new to this topic. A couple of questions - what protocol(s) can be used, HTTP? Can anyone point me towards a resource of this nature please? I understand sockets are in the picture - also new to me. You can easily push info by just executing a HTTP POST to some URL on Server B. Seth - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: data push
Hi Seth, Thanks. And must I open a socket on the client (server B)? Do I attach a listener to it? Thanks Paul. Paul Wallace wrote: Hi All, I would like server A (TC 5.5) to 'push' streams of data to server B (TC 5.5) at random points in time, and for server B to accept the data when it is received. This is not using request / response, hence I am new to this topic. A couple of questions - what protocol(s) can be used, HTTP? Can anyone point me towards a resource of this nature please? I understand sockets are in the picture - also new to me. You can easily push info by just executing a HTTP POST to some URL on Server B. Seth - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: data push
Paul Wallace wrote: Hi Seth, Thanks. And must I open a socket on the client (server B)? Do I attach a listener to it? Forget sockets, we're at a higher level w/ HTTP and URLs. Use the JDK's URLConnection classes (for starters) to open a URL connection. Create a Servlet on Server B that has a doPost() method, for example. That will be your listener. Server A will use the URLConnection to connect to the servlet on Server B and write data to it. At this point, it looks like a socket (input and output streams) except you are talking over HTTP. Seth - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: data push
Thanks, I have most of that in place already. Currently, server A has a HttpURLConnection open and is talking to the Servlet. I can receive data presumably from an InputStream. How do I write data to the Servlet using the connection I have open? Thanks Paul. Hi Seth, Thanks. And must I open a socket on the client (server B)? Do I attach a listener to it? Forget sockets, we're at a higher level w/ HTTP and URLs. Use the JDK's URLConnection classes (for starters) to open a URL connection. Create a Servlet on Server B that has a doPost() method, for example. That will be your listener. Server A will use the URLConnection to connect to the servlet on Server B and write data to it. At this point, it looks like a socket (input and output streams) except you are talking over HTTP. Seth - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: data push
It's not hard to send data from one Tomcat server to another, but the details are a bit complicated. 1. The basic idea is that Server A will periodically send an HTTP POST request to Server B containing a bunch of data. Server B has a servlet that receives this data. (This is the easiest way, because Tomcat Server B knows how to handle HTTP requests!) 2. It's pretty easy to send HTTP requests to another server using java.net.URL and java.net.URLConnection. 3. However, it seems that POST requests are more complicated. I've only done GET requests myself, but here's an article on how to send a POST request: http://www.javaworld.com/javaworld/jw-03-2001/jw-0323-traps.html (That article's kind of old, I'm not sure if it's up to date.) 4. Server A is supposed to send data at random points in time. Does that mean it's done in response to a user request (i.e. in a servlet) or asynchronously (i.e. once an hour, or when a buffer fills up)? It's easy to call your data-sending code from a servlet. If you want to call it asynchronously (outside of a user request) then you'll have to create a separate thread to do it. The easiest way is probably to use a java.util.Timer. 5. To start and shut down a thread properly, you have to use a ServletContextListener. Start the thread (or Timer) in the contextInitialized event and kill it (or call Timer.cancel) on contextDestroyed. Hope this helps! -- Len On 8/10/05, Paul Wallace [EMAIL PROTECTED] wrote: Hi All, I would like server A (TC 5.5) to 'push' streams of data to server B (TC 5.5) at random points in time, and for server B to accept the data when it is received. This is not using request / response, hence I am new to this topic. A couple of questions - what protocol(s) can be used, HTTP? Can anyone point me towards a resource of this nature please? I understand sockets are in the picture - also new to me. Thanks Paul. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: data push
Hi and thanks for that, That's the crux of my question! The data (I am unsure of the protocol it is delivered in) is sent at random points in time i.e not from any request. I wish to create particularly the client (server B) that listens for this data. I (mistakenly) mentioned server A to mimic the data pushes. I can write something to fire off data at intermittent times, but I am more interested in how to capture that data, when no request has been made. This is the reason why I first questioned on Sockets. Perhaps I should have been clearer from the off! thanks Paul. Does that mean it's done in response to a user request (i.e. in a servlet) or asynchronously (i.e. once an hour, or when a buffer fills up)? It's easy to call your data-sending code from a servlet. If you want to call it asynchronously (outside of a user request) then you'll have to create a separate thread to do it. The easiest way is probably to use a java.util.Timer. 5. To start and shut down a thread properly, you have to use a ServletContextListener. Start the thread (or Timer) in the contextInitialized event and kill it (or call Timer.cancel) on contextDestroyed. Hope this helps! -- Len On 8/10/05, Paul Wallace [EMAIL PROTECTED] wrote: Hi All, I would like server A (TC 5.5) to 'push' streams of data to server B (TC 5.5) at random points in time, and for server B to accept the data when it is received. This is not using request / response, hence I am new to this topic. A couple of questions - what protocol(s) can be used, HTTP? Can anyone point me towards a resource of this nature please? I understand sockets are in the picture - also new to me. Thanks Paul. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: data push
Paul Wallace wrote: Thanks, I have most of that in place already. Currently, server A has a HttpURLConnection open and is talking to the Servlet. I can receive data presumably from an InputStream. How do I write data to the Servlet using the connection I have open? Use the connection.getOutputStream() method and write to it like any other output stream. It will show up on the other side when you pull from the input stream. Seth - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: data push
If you send the data via HTTP, then Server B processes that HTTP request just like any other. It's exactly the same as if a user sent a POST request by typing the data into a form and clicking Submit. Server B receives the POST request and executes the appropriate servlet to process it. -- Len On 8/10/05, Paul Wallace [EMAIL PROTECTED] wrote: Hi and thanks for that, That's the crux of my question! The data (I am unsure of the protocol it is delivered in) is sent at random points in time i.e not from any request. I wish to create particularly the client (server B) that listens for this data. I (mistakenly) mentioned server A to mimic the data pushes. I can write something to fire off data at intermittent times, but I am more interested in how to capture that data, when no request has been made. This is the reason why I first questioned on Sockets. Perhaps I should have been clearer from the off! thanks Paul. Does that mean it's done in response to a user request (i.e. in a servlet) or asynchronously (i.e. once an hour, or when a buffer fills up)? It's easy to call your data-sending code from a servlet. If you want to call it asynchronously (outside of a user request) then you'll have to create a separate thread to do it. The easiest way is probably to use a java.util.Timer. 5. To start and shut down a thread properly, you have to use a ServletContextListener. Start the thread (or Timer) in the contextInitialized event and kill it (or call Timer.cancel) on contextDestroyed. Hope this helps! -- Len On 8/10/05, Paul Wallace [EMAIL PROTECTED] wrote: Hi All, I would like server A (TC 5.5) to 'push' streams of data to server B (TC 5.5) at random points in time, and for server B to accept the data when it is received. This is not using request / response, hence I am new to this topic. A couple of questions - what protocol(s) can be used, HTTP? Can anyone point me towards a resource of this nature please? I understand sockets are in the picture - also new to me. Thanks Paul. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: data push
Thanks Len, And what of other protocols? Are sockets then required? What are some other protocols that might be used to push/pull data? (off Tomcat I know ;)) Paul. -Original Message- From: Len Popp [mailto:[EMAIL PROTECTED] Sent: Thursday, 11 August 2005 11:52 AM To: Tomcat Users List Subject: Re: data push If you send the data via HTTP, then Server B processes that HTTP request just like any other. It's exactly the same as if a user sent a POST request by typing the data into a form and clicking Submit. Server B receives the POST request and executes the appropriate servlet to process it. -- Len On 8/10/05, Paul Wallace [EMAIL PROTECTED] wrote: Hi and thanks for that, That's the crux of my question! The data (I am unsure of the protocol it is delivered in) is sent at random points in time i.e not from any request. I wish to create particularly the client (server B) that listens for this data. I (mistakenly) mentioned server A to mimic the data pushes. I can write something to fire off data at intermittent times, but I am more interested in how to capture that data, when no request has been made. This is the reason why I first questioned on Sockets. Perhaps I should have been clearer from the off! thanks Paul. Does that mean it's done in response to a user request (i.e. in a servlet) or asynchronously (i.e. once an hour, or when a buffer fills up)? It's easy to call your data-sending code from a servlet. If you want to call it asynchronously (outside of a user request) then you'll have to create a separate thread to do it. The easiest way is probably to use a java.util.Timer. 5. To start and shut down a thread properly, you have to use a ServletContextListener. Start the thread (or Timer) in the contextInitialized event and kill it (or call Timer.cancel) on contextDestroyed. Hope this helps! -- Len On 8/10/05, Paul Wallace [EMAIL PROTECTED] wrote: Hi All, I would like server A (TC 5.5) to 'push' streams of data to server B (TC 5.5) at random points in time, and for server B to accept the data when it is received. This is not using request / response, hence I am new to this topic. A couple of questions - what protocol(s) can be used, HTTP? Can anyone point me towards a resource of this nature please? I understand sockets are in the picture - also new to me. Thanks Paul. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]