From: Bartłomiej B. <b.b...@ph...> - 2013-09-17 10:47:42
|
Sorry that I didn't response for so long. The approach with two servers and two clients is understandable. But still I have one thing in my mind- as you said: "there is always data that flows back on that port, but it's an acknowledgement, or a response message if the original message was a query of some sort" so basically let's have a scenario: 1. We have a server created. 2. We use hapi-testpanel to connect with that sever. the hapi-testpanel "sending connection" is active - it's connected to the server. I can now from hapi-testpanel (client) send message and client will receive ACK message. As I understand hapi-testpanel (sending connection) is using in this situation: sendAndReceive(msg); but is there anyway that server can send msg to client (connection is established)? So it's like sending ACK but without previously receiving any message to server by client. If anyone know how this can be done - please let me know. Currently I'm using camel hl7 mina2 so maybe with mina2 it's even easier but if anyone knows a way to do this in hapi-hl7 or anything please share your knowledge. Bartłomiej Buczek On 08/27/2013 10:53 PM, James Agnew wrote: > Hi Bartłomiej, > > I have never heard of a situation where a single port is used to both > send and receive messages, at least not in the way that you describe. > HL7 v2 transactions are typically only one direction on a single port > (there is always data that flows back on that port, but it's an > acknowledgement, or a response message if the original message was a > query of some sort). > > It seems to me that this would be a problematic setup anyhow- If > either application was sending messages on the same port whenever they > wanted, you would have collisions and very unpredictable behaviour if > both applications decided to send a message at the same time. > > It would probably be worth confirming with the vendor of the other > system how they are expecting this to work. My guess is that if you > have an application that will sometimes send data to that system, and > at other times receive data from that system, you need to have one > client and one server on your system, and they will also have one > client and one server on theirs. This is how 99.9% of the HL7 v2 world > works. > > Cheers, > James > > > > On Tue, Aug 27, 2013 at 3:06 PM, Bartłomiej Buczek > <b.b...@ph... <mailto:b.b...@ph...>> wrote: > > James, > maybe I'm missing some knowledge about HL7 or I misunderstood it > but I though that there is one server through which applications > can communicate. In you example I would have to have two servers > that listens on different ports - am I right? > The problem of mine comes from that one of the clients that we try > to integrate requires from us address and port to which he will > connect and listen to messages as well as send messages and I have > no idea how exactly this should work on the same port. > > > 2013/8/27 James Agnew <ja...@ja... > <mailto:ja...@ja...>> > > Are you saying that you want to have your application open a > TCP port, accept a connection, receive A02 messages over that > connection, and then send A04 messages out over the same > connection? This is not a normal thing to do with HL7, so I'm > probably misunderstanding. > > Or do you just want your application to be able to open a > server socket and receive A02 messages over connections that > come in, but also to initiate a second client connection and > use that connection to send A04 messages? > > If it's the latter, you just need both parts of the example I > linked to. > > context.newClient(...) creates a client object that can be > used to connect to remote servers and send messages to them, > context.newServer(...) creates a server object that can be > started and will listen for incoming connections and receive > messages on them. > > Cheers, > James > > > On Tue, Aug 27, 2013 at 9:08 AM, Bartłomiej Buczek > <b.b...@ph... <mailto:b.b...@ph...>> wrote: > > Hi James, > not exactly. I want something like this: > 1. Server is already running. > 2. One application is connected to the server and is > sending messages of type ADT_A04 and can receive messages > of type ADT_A02. > 3. I want to create another application, connect it to the > server and make it listen ADT_A02 and send ADT_A04. > > So that those two applications can communicate through HL7 > using TCP/IP. > > > Bartłomiej Buczek > Phoenix Tecnologie Sp. z o.o. > ul. Wiosenna 14/2; 53-017 Wrocław, Poland > NIP: 899 258 73 59 > Tel.+48 71 338 65 64 <tel:%2B48%2071%20338%2065%2064>; Kom.+48 668 891 540 <tel:%2B48%20668%20891%20540> > Fax+48 71 338 65 55 <tel:%2B48%2071%20338%2065%2055> > b.b...@ph... <mailto:b.b...@ph...> > phxtecno.com <http://phxtecno.com> > > On 08/27/2013 02:48 PM, James Agnew wrote: >> Hi Bartłomiej, >> >> It sounds like you're probably looking to create a client >> as opposed to a server. You'll see an example of how to >> do that starting on line 145 here: >> http://hl7api.sourceforge.net/xref/ca/uhn/hl7v2/examples/SendAndReceiveAMessage.html >> >> Cheers, >> James >> >> >> On Tue, Aug 27, 2013 at 6:37 AM, Bartłomiej Buczek >> <b.b...@ph... <mailto:b.b...@ph...>> wrote: >> >> Really no one can help me with this? I'm waiting so >> long and simple no response... >> >> Bartłomiej Buczek >> Phoenix Tecnologie Sp. z o.o. >> ul. Wiosenna 14/2; 53-017 Wrocław, Poland >> NIP: 899 258 73 59 >> Tel.+48 71 338 65 64 <tel:%2B48%2071%20338%2065%2064>; Kom.+48 668 891 540 <tel:%2B48%20668%20891%20540> >> Fax+48 71 338 65 55 <tel:%2B48%2071%20338%2065%2055> >> b.b...@ph... <mailto:b.b...@ph...> >> phxtecno.com <http://phxtecno.com> >> >> On 07/12/2013 12:06 PM, Bartłomiej Buczek wrote: >>> Hi, >>> I was following example send multiple messages out >>> <http://hl7api.sourceforge.net/xref/ca/uhn/hl7v2/examples/SendLotsOfMessages.html> >>> and found out something like this: >>> >>> // Setup server to listen for incoming message >>> int port = 8813; >>> boolean useTls = false; >>> HapiContext context = new DefaultHapiContext(); >>> HL7Service server = context.newServer(port, useTls); >>> >>> >>> // We want to listen ADT^A01 messages >>> ReceivingApplication handler = >>> (ReceivingApplication) new ExampleReceiverApplication(); >>> server.registerApplication("ADT", "A01", handler); >>> >>> So I run the application and as far as I understand >>> I have setup server and a client application which >>> will listen for ADT^A01 messages. Now I want to >>> create another application (let's say another >>> client) which will connect with that already created >>> server and listen for ADT^A02 messages. >>> >>> I found on documentation something like that: >>> >>> "If you are wondering how to integrate HAPI into an >>> existing server application, this is probably the >>> place. Create a class that implements >>> ReceivingApplication, then look at HL7Server and >>> ApplicationRouter to see how to get HAPI to listen >>> for messages on a socket and pass them to your >>> ReceivingApplication." >>> >>> But how should I use HL7Server and ApplicationRouter >>> to connect with previously created server? Maybe I'm >>> missing something in the logic but let's consider >>> that one software already has running server and I >>> want to integrate with them to listen for messages >>> special for my application (like ADT^A02) - how to >>> do this? >>> >>> >>> -- >>> Bartłomiej Buczek >>> Phoenix Tecnologie Sp. z o.o. >>> ul. Wiosenna 14/2; 53-017 Wrocław, Poland >>> NIP: 899 258 73 59 >>> Tel.+48 71 338 65 64 <tel:%2B48%2071%20338%2065%2064>; Kom.+48 668 891 540 <tel:%2B48%20668%20891%20540> >>> Fax+48 71 338 65 55 <tel:%2B48%2071%20338%2065%2055> >>> b.b...@ph... <mailto:b.b...@ph...> >>> phxtecno.com <http://phxtecno.com> >> >> >> ------------------------------------------------------------------------------ >> Introducing Performance Central, a new site from >> SourceForge and >> AppDynamics. Performance Central is your source for >> news, insights, >> analysis and resources for efficient Application >> Performance Management. >> Visit us today! >> http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk >> _______________________________________________ >> Hl7api-devel mailing list >> Hl7...@li... >> <mailto:Hl7...@li...> >> https://lists.sourceforge.net/lists/listinfo/hl7api-devel >> >> > > > > |