From: James A. <ja...@ja...> - 2013-11-21 04:55:54
|
Hi Tom, For what it's worth, we have approached this very problem in the past using the "Java Service Wrapper" library: http://wrapper.tanukisoftware.com/doc/english/download.jsp . This is not trivial by any means, but it's not terrible either and gives a nice way to have your standalone app install as a windows service or linux daemon (via init script) with automatic restart if it ever fails. The Maven appassembler plugin can simplify getting JSW set up a bit, and is used in the HAPI hl7-over-HTTP "relay" application for just that purpose. See the plugins section of this pom.xml<http://sourceforge.net/p/hl7api/code/HEAD/tree/trunk/hapi-mvn/hapi-hl7overhttp/pom.xml> for an example. Depending on what you're doing, this may well be overkill though. If you're just looking for something you can start by hand occasionally I would just just build an executable JAR as you have, and kill it with control-C when done. Cheers, James On Tue, Nov 19, 2013 at 6:48 PM, Tom Wilson <tw...@su...> wrote: > Hi. I’m building my first HAPI application. I followed the sample code > to build a receiving application and can successfully run a jar which > starts the server, starts a client, sends a message, and shuts down the > server (basically the sample code). Now, what’s the quickest way to get my > application to run as a standalone jar file, so that I can let it run on my > local machine and start throwing messages at it? Do I write a main method > that starts the server and then do some “wait forever” trick? Is there a > best practice for running a HAPI ReceivingApplication as a standalone jar? > > > > For example, let’s say I package my application as MyHapiReceiver.jar with > a main method > > > > From the command line, I run: > > > > %java –jar MyHapiReceiver.jar > > > > And then inside eclipse I start running client tests, which send messages > to port 1011 (default) > > > > When I’m done testing, I’ll need to stop MyHapi.jar gracefully. > > > > Simplicity is key. I want to get this up and running without putting it in > a container or ESB. However I do have an instance of JBoss EAP 6 (no ESB) > if that makes it easier (I suspect it won’t). > > > > If someone has wrapper code to make the sample receiver application run as > a standalone jar, that may be enough: > > > http://hl7api.sourceforge.net/xref/ca/uhn/hl7v2/examples/ExampleReceiverApplication.html > > > > Any advice is appreciated. > > > > -tom > > > > > ------------------------------------------------------------------------------ > Shape the Mobile Experience: Free Subscription > Software experts and developers: Be at the forefront of tech innovation. > Intel(R) Software Adrenaline delivers strategic insight and game-changing > conversations that shape the rapidly evolving mobile landscape. Sign up > now. > http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk > _______________________________________________ > Hl7api-devel mailing list > Hl7...@li... > https://lists.sourceforge.net/lists/listinfo/hl7api-devel > > |