• Post Reply Bookmark Topic Watch Topic
  • New Topic

Micros Fidelio Integration new project Help  RSS feed

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I'm new in this excelent forum and I think this will not be my last post.

I'm working in a Hospital as a java developer and I have build the Intranet with JAVA / Struts / Tomcat.

Situation:

I have to do an integration with a thirdparty aplication named Micros Fidelio. This is an aplication used for many hotels in order to invoice what TV Film the customers have been seen (Pay Per View).

In our Hospital we have to invoice to the customer so we need some integration with them....

Micro Fidelios is a CLosed aplication server with a implemented protocol via serial (rs232) so we can comunicate each other with this protocol.

I have downloaded a java Api DLL (Windows) that can comunicate with them without problems..

My Problem:

This server is always (24 hours) sending messages when any pacient have been seen a Film, so I have to listen for any message all the time, and as well I have to send a Check in when the pacient want to contract the Pay per view (only Once).

WHen the pacient leave the Hospital I have to Check out to the server in order to finish the Pay Per view future on this room (It can we started again with a Check in)...

Every time the Pacient see a Film the server send a "POST" with the price and the room number.

The mesages I get from the systems are looking like this:

For Check in the record may look like this:
<STX>GI|G#1000201|RN101|GNMr. Wong|GSN|GV0|GLES|TVTU|VRVA|DA070907|TI101059|<ETX><LRC>

for check out you may send the following record:
<STX>GO|G#1000201|RN101|GSN|DA070907|TI111005|<ETX><LRC>


My Questions:

1) What Tecnologie/s I need to use in order to have a program continously running catching the Events ?

2) For check in/out I would like to build a Java Struts jsp interface. Can JSP Speak with the WebService/Servlet ?

3) I have to syncronize something ?


I have NO experience (0) with WebServices, JMS, Threads, etc..

I don't know how to start with this project so I'll aprecciatte any help...

Thank you very much in advance for your time.
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jaume Guillamon:
I have NO experience (0) with WebServices


Well, so far this isn't a problem because when people talk about Web Services they are usually talking about SOAP web services.
This is clearly no the case here.

I have downloaded a java Api DLL (Windows) that can comunicate with them without problems..


This is in line with your statement that you are communicating of RS-232. However then you state:

Every time the Pacient see a Film the server send a "POST" with the price and the room number.

The mesages I get from the systems are looking like this:

For Check in the record may look like this:
<STX>GI|G#1000201|RN101|GNMr. Wong|GSN|GV0|GLES|TVTU|VRVA|DA070907|TI101059|<ETX><LRC>

for check out you may send the following record:
<STX>GO|G#1000201|RN101|GSN|DA070907|TI111005|<ETX><LRC>


POST is an HTTP command. I can't see any reason why they would use HTTP over an RS-232 link. So I'm left a bit confused here...
Furthermore the messages aren't even XML.

So at this point this doesn't seem to have anything to do with web services.
If however the MF Server is POSTing those messages to you over the network then you should be able to "listen" with a Servlet and process the incoming message with its doPost method. You still will have to parse the message (POST data) with your own code as the message isn't even in XML.

If you however are "listening" to the RS-232 port with the Java API (which has nothing to do with web services) then you will want to look at Doug Lea's java.util.Executor (Flexible Event Delivery with Executors). Basically the listener should acquire a separate thread/task to process each incoming message. Initially I would plan for a deployment of the listener as a command line program run as a daemon/background process (a service in windows) which stores the processed data in a database as it is not clear whether the Java API can be safely run inside a container environment.

Can JSP Speak with the WebService/Servlet?


JSPs are Servlets. The container simply generates them for you from your JSP code. Servlets can talk to other Servlet. And Servlets can access Web Service Servers. Though from your description it doesn't seem like there is a web service involved at all.
 
Jaume Guillamon
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Than you Peer Reynders ,

I have been thinking about it and of course I don't have to use Web services (xml).

My Program must be started as a listener (serialEvent(SerialPortEvent event))and then I have to write some times to the port for check/in/out messages. As well I will create a control Database in order to know if I already have been sent the chek/in/out....

They can send messages all the time with the import when a customer have been seen a film.

Do you have some example of a java program that have some methods syncronized ?

I have to create a SERVLET ? or simply a syncronized hava program with a MAIN ?

As this program is reading to the database all the time, must be alive 24 hours, so I have a program named Exe4J that can convert a java program with a MAIN to a EXE. As well I have a program called AppToService that can install it as a windows service.

Thank you again
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jaume Guillamon:
Do you have some example of a java program that have some methods syncronized ?


I'd recommend that you look at the
Java Tutorial: Concurrency

Based on the information that you have given I'd go with a Blocking Queue. The serialEvent handler acts as the producer - it should capture the event information as quickly as possible, possibly read it into your own event context object and add it to the queue. Meanwhile you should start one consumer (worker) thread, that removes the event context from the queue and does all the heavy lifting for each context (data base accesses, etc.). As long as you stick with one consumer (worker) thread and as long as the blocking queue is the only thing that BOTH the worker and the serialEvent handler access there should be no need to synchronize anything because that work has been already been done for you by the Blocking Queue.

Producer-Consumer Pattern

Here is another example from "5.3 Blocking Queues and the producer-consumer pattern" of Java Concurrency in Practice (amazon US)

You may need a second blocking queue as you seem to need to write back to the port. The worker thread could then simply place the information required on the second blocking queue so that a third (port writer) thread could write the appropriate information to the port.

Originally posted by Jaume Guillamon:
I have to create a SERVLET ? or simply a syncronized hava program with a MAIN ?


I do not see any need to create a servlet; a command-line program should suffice. You will need a separate application for check-in and check-out. However that information can go straight to the database - or do you see a reason for needing to check-in before the first request is being made? If not the worker thread can pick up the check-in information (and forward it) with the first request that comes in.

The Java Service Wrapper seems to a be pretty popular way of writing windows services in Java.
CodeGear: Running Java Applications as a Windows Service

Devx: Converting Your Java App into a Windows Service.

Jeffrey Richter wasn't too keen on any kind of "Application to Service" utility in Programming Server-Side Applications for Microsoft Windows 2000 (p.79)
The Microsoft Windows 2000 Resource Kit contains a utility named SrvAny.exe that allows an existing application to be started remotely, just like a true service. However, SrcAny does not allow and application to be remotely administered in any other way, and therefore should be used as a short-term solution only. You are strongly encouraged to modify your application's code to turn into a full fledged service and ignore the SrcAny utility altogether.
 
Jaume Guillamon
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Peer Reynders for your quick answer and help, It has been help my doubts a lot !

Thanks again.
Jaume.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!