Reference application
| Preliminary content This section is work in progress. |
The reference application is an IPF application that demonstrates how to use a broad range of IPF and Camel features. It is an example from the order processing domain. It consumes (over-simplified) order requests over HTTP and transforms these request messages into a different format depending on the order category. The transformation results are written to the filesystem. The reference application can be found under tutorials/ref in the IPF source tree. The Eclipse project name is org.openehealth.ipf.tutorials.ref. For instructions how to import IPF sources into Eclipse refer to the Development section of the reference manual. To start a single instance of the reference application you need to start a Derby database server and an IPF instance. To start the database server select Run->Run Configurations... from the Eclipse menu, choose Java Application->Derby - Start in the dialog box and press the Run button. You should see the following output on the console (German language settings).
Apache Derby Network Server 10.4.1.3 - (648739) wurde gestartet und ist seit 2008-12-04 08:01:01.541 GMT bereit, Verbindungen am Port 1527 zu akzeptieren.
To start the IPF instance select Run->Run Configurations... from the Eclipse menu, choose Java Application->TutorialServer1 in the dialog box and press the Run button. You should see the following output on the console (warnings omitted).
INFO - using stored sequence default INFO - Using Persistence Adapter: AMQPersistenceAdapter(data\activemq1) INFO - ActiveMQ null JMS Message Broker (broker1) is starting INFO - For help or more information please see: http://activemq.apache.org/ INFO - AMQStore starting using directory: data\activemq1 INFO - JMX consoles can connect to service:jmx:rmi:///jndi/rmi://localhost:1801/jmxrmi INFO - Kaha Store using data directory data\activemq1\kr-store\state INFO - Active data files: [] WARN - The ReferenceStore is not valid - recovering ... INFO - Kaha Store successfully deleted data directory data\activemq1\kr-store\data INFO - Journal Recovery Started from: DataManager:(data-) INFO - Kaha Store using data directory data\activemq1\kr-store\data INFO - Recovered 28 operations from redo log in 0.328 seconds. INFO - Finished recovering the ReferenceStore INFO - ActiveMQ JMS Message Broker (broker1, ID:lap-xp-0818-3028-1228379536237-0:0) started ... INFO - Registered replay strategy with identifier http INFO - Registered replay strategy with identifier file INFO - Registered replay strategy with identifier direct 2008-12-04 09:32:20.751::INFO: jetty-6.1.11 2008-12-04 09:32:20.876::INFO: Started SelectChannelConnector@0.0.0.0:8081 INFO - Connector vm://broker1 Started
Now the reference application is ready to accept order request messages via http://localhost:8081/tutorial. Here are two sample order request messages and their transformation results.
| Request message | Transformed message |
|---|---|
<order xmlns="http://www.openehealth.org/tutorial">
<customer>123</customer>
<category>animals</category>
<item>ozelot</item>
<count>3</count>
</order> |
Order ----- Customer: 123 Item: ozelot Count: 3 |
<order xmlns="http://www.openehealth.org/tutorial">
<customer>123</customer>
<category>books</category>
<item>eating ozelots</item>
<count>3</count>
</order> |
<?xml version="1.0" encoding="UTF-8"?>
<ns0:order xmlns:ns0="http://www.openehealth.org/tutorial" category="books">
<ns1:customer xmlns:ns1="http://www.openehealth.org/tutorial">123</ns1:customer>
<ns2:item xmlns:ns2="http://www.openehealth.org/tutorial">eating ozelots</ns2:item>
<ns3:count xmlns:ns3="http://www.openehealth.org/tutorial">3</ns3:count>
</ns0:order> |
The transformed messages are written to the order/out folder if processing was successful otherwise to the order/error-app or order/error-sys folder. For sending these messages you can use the Eclipse HTTP client. Here's a screenshot made after sending an order request.
The reference application also implements the flow manager which can be accessed via the Eclipse flow management client or a generic JMX client. To connect to the flow management service with the flow management client:
- Start the flow management client
- Create a connection on port 1801.
- Right-click on the connection and select Open Flow Manager from the context menu.
The flow management window opens. To get a list of all tracked message flows so far press the Search button. Depending on the number of order requests you've sent you'll see more or less flows in the result list of the Search view. For more information on how to use the flow management client refer to the platform manager section of the reference manual.