| <!doctype html> |
| <html data-n-head-ssr data-n-head=""> |
| <head data-n-head=""> |
| <title data-n-head="true">Eclipse unide - PPMP Use Cases: Template for PPMP transformation</title><meta data-n-head="true" charset="utf-8"><meta data-n-head="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-n-head="true" data-hid="description" name="description" content="Eclipse Unide: Understand Industry devices"><link data-n-head="true" rel="icon" type="image/x-icon" href="/unide/favicon.ico"><base href="/unide/"><link rel="stylesheet" href="/unide/files/1750fa95f99b26cdec14.css"><link rel="stylesheet" href="/unide/files/08ee945502042ce842dc.css"> |
| </head> |
| <body data-n-head=""> |
| <div data-server-rendered="true" id="__nuxt"><!----><div id="__layout"><div><header class="nav-header"><div class="container"><nav class="navbar"><div id="navMenu" class="navbar-menu"><div class="navbar-start"><a href="/unide/" class="navbar-item"> |
| Home |
| </a> <a href="/unide/proposal" class="navbar-item"> |
| Proposal |
| </a> <a href="/unide/specification" class="navbar-item"> |
| Specification |
| </a> <a href="/unide/blog" class="navbar-item is-active"> |
| Blog Archives |
| </a> <a href="/unide/faq" class="navbar-item"> |
| FAQ |
| </a></div></div> <div class="navbar-brand"><div class="navbar-burger burger"><span></span> <span></span> <span></span></div> <a href="/unide/" class="navbar-item nuxt-link-active"><img src="logo.svg"></a></div></nav></div></header> <div class="container"><div class="header clearfix"></div> <div class="columns"><div class="article column is-8"><h1 class="title is-3"> |
| PPMP Use Cases: Template for PPMP transformation |
| </h1> <h2 class="subtitle is-6"><i class="fa fa-calendar"></i> |
| 09/04/18 |
| </h2> <div class="content"><div><h1>Quick start</h1> |
| <p>In <a href="https://www.eclipse.org/unide/blog/2018/2/11/Transform-PPMP-with-camel/">a previous blog post</a>, I have already introduced Apache Camel as a tool to transform to PPMP. In this post, I want to dive a little deeper to get you started with your own transformation.<br> |
| You can find corresponding source code with some transformation examples <a href="https://github.com/eclipselabs/eclipseiot-testbed-productionperformancemanagement/tree/master/camel-integrator">in the repository of the Eclipse PPM Testbed</a>. After download or checkout of the project, you can easily package everything necessary for an installation via <a href="https://maven.apache.org/">Apache Maven</a> and java 8+:</p> |
| <pre class="language-bash"><code class="language-bash"><span class="token function">git</span> clone https://github.com/eclipselabs/eclipseiot-testbed-productionperformancemanagement.git |
| <span class="token function">cd</span> eclipseiot-testbed-productionperformancemanagement |
| <span class="token function">cd</span> camel-integrator |
| mvn package |
| </code></pre> |
| <p>After successful build, you should get a zip file at <code>target/camel-integrator-*-assembly.zip</code> with the following content</p> |
| <ul> |
| <li><code>bin</code><br> |
| The IntegratorStarter* files for Windows and Linux can be used to start the integrator manually. WinServiceInstaller.bat und WinServiceUninstaller.bat can be executed with Admin permissions in Windows to register/unregister this java application as Windows Service called "Integrator Service".</li> |
| <li><code>conf</code><br> |
| This is where the main configuration file <code>application-context.xml</code>, further included spring xml configurations, as well as the configuration for logging <code>log4j.properties</code> and a key-value-file for quick configuration <code>application.properties</code> can be found. After modification of any of them, the integrator should be restarted.</li> |
| <li><code>lib</code><br> |
| Contains all java dependencies and their dependencies as individual jar files</li> |
| <li><code>log</code><br> |
| After the first start, you will find an additional directory that contains the logs of every execution, as defined in the <code>conf/log4j.properties</code> file.</li> |
| </ul> |
| <p>So this <code>camel-integrator-*-assembly.zip</code> is all you need, ready to being shipped and installed in your target system.</p> |
| <h1>How can I modify this?</h1> |
| <p>In the <code>conf</code> folder of the output or <code>src/main/resources</code> src folder, you'll find multiple examples on how to use Apache Camel with Production Performance Management Protocol. Most of the examples are based on <a href="https://github.com/apache/camel/blob/master/components/camel-spring/src/main/docs/spring.adoc">spring xml</a>.<br> |
| The most important terms to understand them are:</p> |
| <table> |
| <thead> |
| <tr> |
| <th>xml tag</th> |
| <th>meaning</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td>bean</td> |
| <td>additional functionality, coded as java class / function</td> |
| </tr> |
| <tr> |
| <td>camelContext</td> |
| <td>the main, camel specific configurations</td> |
| </tr> |
| <tr> |
| <td>route</td> |
| <td>describes the data flow as process</td> |
| </tr> |
| <tr> |
| <td>from / to</td> |
| <td>entry / exit points for the data flow. This is also, were external systems are accessed via <a href="https://github.com/apache/camel/tree/camel-2.21.0/components">components</a></td> |
| </tr> |
| <tr> |
| <td>onException</td> |
| <td>error handling for the data flow</td> |
| </tr> |
| <tr> |
| <td>pipeline, multicast, ...</td> |
| <td>routing of data via <a href="http://camel.apache.org/enterprise-integration-patterns.html">Enterprise Integration pattern</a></td> |
| </tr> |
| </tbody> |
| </table> |
| <p>Among others, you'll find:</p> |
| <div class="card figure is-pulled-right"> |
| <div class="card-image"> |
| <figure class="image"> |
| <img alt="html log file" title="html log file" src="/unide/images/blog/Transform-PPMP-with-camel-2-logfile.png"> |
| </figure> |
| </div> |
| <div class="card-content"> |
| html logfile before transformation to PPMP |
| </div> |
| </div> |
| <ul> |
| <li><code>application-context.xml</code><br> |
| Main entry file to start camel routes. It contains a general PPMP validation REST endpoint that reuses the route from <code>ppmp-validate-context.xml</code></li> |
| <li><code>mqtt-context.xml</code><br> |
| A simple example of converting transport protocol (mqtt to REST), without looking at the payload</li> |
| <li><code>ppmp-splitAndRewrite-context.xml</code><br> |
| Shows how to receive (PPMP-) payload via different REST paths (/rest or /ppm), and each forwarding to two seperate endpoints (/rest and /ppm) |
| <ul> |
| <li><code>ppmpRewrite.xml</code> and <code>ppmRewrite.xml</code><br> |
| mapping examples to rewrite the urls</li> |
| </ul> |
| </li> |
| <li><code>ppmp-validate-context.xml</code><br> |
| A simple validation route for PPMP messages that can be reused in many other routes.</li> |
| <li><code>psi6000-transform-context.xml</code><br> |
| A more advanced example of converting a psi6000 JSON format, converting it to plain old java object (POJO), transforming that to PPMP POJOs (using <a href="https://github.com/eclipse/unide.java">unide.java</a>) and forwarding these to actual REST endpoints</li> |
| <li><code>kistler.xml</code><br> |
| This example takes html files with a structure similar to the test file in <a href="https://github.com/eclipselabs/eclipseiot-testbed-productionperformancemanagement/blob/master/camel-integrator/src/test/data/00000855.html"><code>src/test/data/00000855.html</code></a>, cleans the html structure, retrieves the relevant parts via <a href="https://en.wikipedia.org/wiki/XPath">XPath</a> and creates a PPMP process message out of that</li> |
| <li><code>application.properties</code><br> |
| Contains key/value pairs that can be used in the camel context configurations.</li> |
| <li><code>log4j.properties</code><br> |
| The configuration for logging. For testing purposes, the log4j.properties in /src/test/resources is used.</li> |
| </ul> |
| <p>In order to get familiar with these transformations, I suggest you:</p> |
| <ul> |
| <li>open the <code>application-context.xml</code> in your favorite editor</li> |
| <li>remove the <code><import .../></code> statements</li> |
| <li>add your own <code><route>...</route></code>, maybe as simple as<pre class="language-xml"><code class="language-xml"> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>route</span><span class="token punctuation">></span></span> |
| <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>from</span> <span class="token attr-name">uri</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>jetty:http://0.0.0.0:9090/<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span> |
| <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>setBody</span><span class="token punctuation">></span></span> |
| <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>simple</span><span class="token punctuation">></span></span>hello world!<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>simple</span><span class="token punctuation">></span></span> |
| <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>setBody</span><span class="token punctuation">></span></span> |
| <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>route</span><span class="token punctuation">></span></span> |
| </code></pre> |
| </li> |
| <li>start a run directly (with bundling to a zip file) with:<pre class="language-bash"><code class="language-bash"> mvn exec:java |
| </code></pre> |
| </li> |
| <li>and review the result. With the example above, just open the url <a href="http://localhost:9090">http://localhost:9090</a> and see the <code>hello world!</code> in your browser</li> |
| </ul> |
| <p>If you prefer a visual model of these camel xml definitions, you could also make use of <a href="https://tools.jboss.org/features/fusetools.html">JBoss Fuse Tooling</a> which is available for <a href="https://projects.eclipse.org/releases/oxygen">Eclipse Workbench 4.3+</a> through <a href="https://marketplace.eclipse.org/content/jboss-tools">the Marketplace</a>. Be aware that this might cause additional overhead.</p> |
| <div class="card figure"> |
| <div class="card-image"> |
| <figure class="image"> |
| <img alt="JBoss Tools" title="JBoss Tools for Eclipse Workbench" src="/unide/images/blog/Transform-PPMP-with-camel-2-eclipse.png"> |
| </figure> |
| </div> |
| <div class="card-content"> |
| JBoss Tools for Eclipse Workbench |
| </div> |
| </div> |
| <p>If you want to make use of any other of the (as of camel 2.21.0) <a href="https://github.com/apache/camel/tree/camel-2.21.0/components">281+ components</a>, you should add the respective maven dependency to the <code>pom.xml</code>. For example:</p> |
| <pre class="language-xml"><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>project</span> <span class="token attr-name">xmlns</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://maven.apache.org/POM/4.0.0<span class="token punctuation">"</span></span> <span class="token attr-name"><span class="token namespace">xmlns:</span>xsi</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://www.w3.org/2001/XMLSchema-instance<span class="token punctuation">"</span></span> |
| <span class="token attr-name"><span class="token namespace">xsi:</span>schemaLocation</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd<span class="token punctuation">"</span></span><span class="token punctuation">></span></span> |
| ... |
| <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>dependencies</span><span class="token punctuation">></span></span> |
| <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>dependency</span><span class="token punctuation">></span></span> |
| <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>groupId</span><span class="token punctuation">></span></span>org.apache.camel<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>groupId</span><span class="token punctuation">></span></span> |
| <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>artifactId</span><span class="token punctuation">></span></span>camel-amqp<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>artifactId</span><span class="token punctuation">></span></span> |
| <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>version</span><span class="token punctuation">></span></span>${camel.version}<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>version</span><span class="token punctuation">></span></span> |
| <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>dependency</span><span class="token punctuation">></span></span> |
| ... |
| <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>dependencies</span><span class="token punctuation">></span></span> |
| ... |
| <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>project</span><span class="token punctuation">></span></span> |
| </code></pre> |
| <h1>Testing</h1> |
| <p>Testing is an important part of the development cycle, especially for the core components that have to work reliably in a production environment.<br> |
| The project includes example tests in the <code>src/test</code> folder:</p> |
| <ul> |
| <li><code>java</code><br> |
| contains the actual java unit tests that make use of <a href="https://github.com/apache/camel/blob/61a58836da57bab38ce719cbd1effd36253687a4/docs/user-manual/en/spring-testing.adoc"><code>CamelSpringTestSupport</code></a> to wire xml CamelContext configuration, test data and expected results together</li> |
| <li><code>resources</code><br> |
| contains the spring xml configuration that is used by the java test classes and resamble the actual configurations from <code>src/main/resources</code></li> |
| <li><code>data</code><br> |
| contains testdata for the data flows and the transformation</li> |
| </ul> |
| <p>Tests can easily be run from within an IDE (eclipse, visual code studio etc.) or via commandline</p> |
| <pre class="language-bash"><code class="language-bash">mvn <span class="token function">test</span> |
| </code></pre> |
| <p>You will see the output of the test runs. If it looks like this, it works as expected:</p> |
| <pre class="language-bash"><code class="language-bash">Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.846 sec |
| |
| Results <span class="token keyword">:</span> |
| |
| Tests run: 3, Failures: 0, Errors: 0, Skipped: 0 |
| |
| <span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> ------------------------------------------------------------------------ |
| <span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> BUILD SUCCESS |
| <span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> ------------------------------------------------------------------------ |
| <span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> Total time: 32.267 s |
| <span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> Finished at: 2018-04-09T15:25:25+02:00 |
| <span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> Final Memory: 25M/85M |
| <span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> ------------------------------------------------------------------------ |
| </code></pre> |
| <h1>Summary</h1> |
| <p>The provided camel project template facilitates the creation of simple connectors. You can download it, modify or extend it, package the integrator to a zip file and deploy it on a target server. The included scripts help registering the integrator as an operating system service to run 24/7.</p> |
| </div></div> <div class="columns pageNav"><div class="column"><a href="/unide/blog/2018/3/26/Release-0.2.0" class="button is-fullwidth"><span class="icon"><i class="fa fa-chevron-left"></i></span> <span>Unide 0.2.0 released</span></a></div> <div class="column"><a href="/unide/blog/2019/3/1/Version-3" class="button is-fullwidth"><span>PPMP Version 3 release candidate</span> <span class="icon"><i class="fa fa-chevron-right"></i></span></a></div></div></div> <div class="sidebar column is-3 is-offset-1"><div class="recentPosts"><h4 class="subtitle is-5"> |
| Recent Posts |
| </h4> <ul><li><a href="/unide/blog/2019/3/1/Version-3"> |
| PPMP Version 3 release candidate |
| </a></li><li><a href="/unide/blog/2018/9/4/Template-for-PPMP-transformation" class="nuxt-link-exact-active nuxt-link-active"> |
| PPMP Use Cases: Template for PPMP transformation |
| </a></li><li><a href="/unide/blog/2018/3/26/Release-0.2.0"> |
| Unide 0.2.0 released |
| </a></li><li><a href="/unide/blog/2018/2/13/grinding-machine-scenario"> |
| PPMP Use Cases: Unide and the Eclipse Production Performance Management Testbed |
| </a></li><li><a href="/unide/blog/2018/2/11/Transform-PPMP-with-camel"> |
| PPMP Use Cases: Simple Transformation with Apache Camel |
| </a></li></ul></div> <div class="blogArchives"><h4 class="subtitle is-5"> |
| Blog Archives |
| </h4> <ul><li><a href="/unide/blog/2019/3"> |
| April 2019 |
| </a> |
| (1) |
| </li><li><a href="/unide/blog/2018/9" class="nuxt-link-active"> |
| October 2018 |
| </a> |
| (1) |
| </li><li><a href="/unide/blog/2018/3"> |
| April 2018 |
| </a> |
| (1) |
| </li><li><a href="/unide/blog/2018/2"> |
| March 2018 |
| </a> |
| (2) |
| </li><li><a href="/unide/blog/2018/1"> |
| February 2018 |
| </a> |
| (1) |
| </li><li><a href="/unide/blog/2017/10"> |
| November 2017 |
| </a> |
| (2) |
| </li><li><a href="/unide/blog/2017/6"> |
| July 2017 |
| </a> |
| (2) |
| </li><li><a href="/unide/blog/2017/3"> |
| April 2017 |
| </a> |
| (1) |
| </li><li><a href="/unide/blog/2016/9"> |
| October 2016 |
| </a> |
| (4) |
| </li></ul></div></div></div></div> <footer class="footer"><div class="container"><div class="columns is-mobile is-multiline is-centered"><div class="column is-narrow"><a href="http://www.eclipse.org">Eclipse Foundation</a></div> <div class="column is-narrow"><a href="http://www.eclipse.org/legal/privacy.php">Privacy Policy</a></div> <div class="column is-narrow"><a href="http://www.eclipse.org/legal/termsofuse.php">Terms of Use</a></div> <div class="column is-narrow"><a href="http://www.eclipse.org/legal/copyright.php">Copyright Agent</a></div> <div class="column is-narrow"><a href="https://eclipse.org/security/">Security reports</a></div> <div class="column is-narrow"><a href="http://www.eclipse.org/legal/">Legal</a></div></div></div></footer></div></div></div><script>window.__NUXT__={layout:"sidebar",data:[{post:{name:"Template-for-PPMP-transformation",content:'<h1>Quick start</h1>\n<p>In <a href="https://www.eclipse.org/unide/blog/2018/2/11/Transform-PPMP-with-camel/">a previous blog post</a>, I have already introduced Apache Camel as a tool to transform to PPMP. In this post, I want to dive a little deeper to get you started with your own transformation.<br>\nYou can find corresponding source code with some transformation examples <a href="https://github.com/eclipselabs/eclipseiot-testbed-productionperformancemanagement/tree/master/camel-integrator">in the repository of the Eclipse PPM Testbed</a>. After download or checkout of the project, you can easily package everything necessary for an installation via <a href="https://maven.apache.org/">Apache Maven</a> and java 8+:</p>\n<pre class="language-bash"><code class="language-bash"><span class="token function">git</span> clone https://github.com/eclipselabs/eclipseiot-testbed-productionperformancemanagement.git\n<span class="token function">cd</span> eclipseiot-testbed-productionperformancemanagement\n<span class="token function">cd</span> camel-integrator\nmvn package\n</code></pre>\n<p>After successful build, you should get a zip file at <code>target/camel-integrator-*-assembly.zip</code> with the following content</p>\n<ul>\n<li><code>bin</code><br>\nThe IntegratorStarter* files for Windows and Linux can be used to start the integrator manually. WinServiceInstaller.bat und WinServiceUninstaller.bat can be executed with Admin permissions in Windows to register/unregister this java application as Windows Service called "Integrator Service".</li>\n<li><code>conf</code><br>\nThis is where the main configuration file <code>application-context.xml</code>, further included spring xml configurations, as well as the configuration for logging <code>log4j.properties</code> and a key-value-file for quick configuration <code>application.properties</code> can be found. After modification of any of them, the integrator should be restarted.</li>\n<li><code>lib</code><br>\nContains all java dependencies and their dependencies as individual jar files</li>\n<li><code>log</code><br>\nAfter the first start, you will find an additional directory that contains the logs of every execution, as defined in the <code>conf/log4j.properties</code> file.</li>\n</ul>\n<p>So this <code>camel-integrator-*-assembly.zip</code> is all you need, ready to being shipped and installed in your target system.</p>\n<h1>How can I modify this?</h1>\n<p>In the <code>conf</code> folder of the output or <code>src/main/resources</code> src folder, you\'ll find multiple examples on how to use Apache Camel with Production Performance Management Protocol. Most of the examples are based on <a href="https://github.com/apache/camel/blob/master/components/camel-spring/src/main/docs/spring.adoc">spring xml</a>.<br>\nThe most important terms to understand them are:</p>\n<table>\n<thead>\n<tr>\n<th>xml tag</th>\n<th>meaning</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>bean</td>\n<td>additional functionality, coded as java class / function</td>\n</tr>\n<tr>\n<td>camelContext</td>\n<td>the main, camel specific configurations</td>\n</tr>\n<tr>\n<td>route</td>\n<td>describes the data flow as process</td>\n</tr>\n<tr>\n<td>from / to</td>\n<td>entry / exit points for the data flow. This is also, were external systems are accessed via <a href="https://github.com/apache/camel/tree/camel-2.21.0/components">components</a></td>\n</tr>\n<tr>\n<td>onException</td>\n<td>error handling for the data flow</td>\n</tr>\n<tr>\n<td>pipeline, multicast, ...</td>\n<td>routing of data via <a href="http://camel.apache.org/enterprise-integration-patterns.html">Enterprise Integration pattern</a></td>\n</tr>\n</tbody>\n</table>\n<p>Among others, you\'ll find:</p>\n<div class="card figure is-pulled-right">\n\t<div class="card-image">\n\t\t<figure class="image">\n\t\t\t<img alt="html log file" title="html log file" src="/unide/images/blog/Transform-PPMP-with-camel-2-logfile.png"></img>\n\t\t</figure>\n\t</div>\n\t<div class="card-content">\n\t\thtml logfile before transformation to PPMP\n\t</div>\n</div>\n<ul>\n<li><code>application-context.xml</code><br>\nMain entry file to start camel routes. It contains a general PPMP validation REST endpoint that reuses the route from <code>ppmp-validate-context.xml</code></li>\n<li><code>mqtt-context.xml</code><br>\nA simple example of converting transport protocol (mqtt to REST), without looking at the payload</li>\n<li><code>ppmp-splitAndRewrite-context.xml</code><br>\nShows how to receive (PPMP-) payload via different REST paths (/rest or /ppm), and each forwarding to two seperate endpoints (/rest and /ppm)\n<ul>\n<li><code>ppmpRewrite.xml</code> and <code>ppmRewrite.xml</code><br>\nmapping examples to rewrite the urls</li>\n</ul>\n</li>\n<li><code>ppmp-validate-context.xml</code><br>\nA simple validation route for PPMP messages that can be reused in many other routes.</li>\n<li><code>psi6000-transform-context.xml</code><br>\nA more advanced example of converting a psi6000 JSON format, converting it to plain old java object (POJO), transforming that to PPMP POJOs (using <a href="https://github.com/eclipse/unide.java">unide.java</a>) and forwarding these to actual REST endpoints</li>\n<li><code>kistler.xml</code><br>\nThis example takes html files with a structure similar to the test file in <a href="https://github.com/eclipselabs/eclipseiot-testbed-productionperformancemanagement/blob/master/camel-integrator/src/test/data/00000855.html"><code>src/test/data/00000855.html</code></a>, cleans the html structure, retrieves the relevant parts via <a href="https://en.wikipedia.org/wiki/XPath">XPath</a> and creates a PPMP process message out of that</li>\n<li><code>application.properties</code><br>\nContains key/value pairs that can be used in the camel context configurations.</li>\n<li><code>log4j.properties</code><br>\nThe configuration for logging. For testing purposes, the log4j.properties in /src/test/resources is used.</li>\n</ul>\n<p>In order to get familiar with these transformations, I suggest you:</p>\n<ul>\n<li>open the <code>application-context.xml</code> in your favorite editor</li>\n<li>remove the <code><import .../></code> statements</li>\n<li>add your own <code><route>...</route></code>, maybe as simple as<pre class="language-xml"><code class="language-xml"> <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>route</span><span class="token punctuation">></span></span>\n \t<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>from</span> <span class="token attr-name">uri</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>jetty:http://0.0.0.0:9090/<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>\n \t<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>setBody</span><span class="token punctuation">></span></span>\n \t\t<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>simple</span><span class="token punctuation">></span></span>hello world!<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>simple</span><span class="token punctuation">></span></span>\n \t<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>setBody</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation"></</span>route</span><span class="token punctuation">></span></span>\n</code></pre>\n</li>\n<li>start a run directly (with bundling to a zip file) with:<pre class="language-bash"><code class="language-bash"> mvn exec:java\n</code></pre>\n</li>\n<li>and review the result. With the example above, just open the url <a href="http://localhost:9090">http://localhost:9090</a> and see the <code>hello world!</code> in your browser</li>\n</ul>\n<p>If you prefer a visual model of these camel xml definitions, you could also make use of <a href="https://tools.jboss.org/features/fusetools.html">JBoss Fuse Tooling</a> which is available for <a href="https://projects.eclipse.org/releases/oxygen">Eclipse Workbench 4.3+</a> through <a href="https://marketplace.eclipse.org/content/jboss-tools">the Marketplace</a>. Be aware that this might cause additional overhead.</p>\n<div class="card figure">\n\t<div class="card-image">\n\t\t<figure class="image">\n\t\t\t<img alt="JBoss Tools" title="JBoss Tools for Eclipse Workbench" src="/unide/images/blog/Transform-PPMP-with-camel-2-eclipse.png"></img>\n\t\t</figure>\n\t</div>\n\t<div class="card-content">\n\t\tJBoss Tools for Eclipse Workbench\n\t</div>\n</div>\n<p>If you want to make use of any other of the (as of camel 2.21.0) <a href="https://github.com/apache/camel/tree/camel-2.21.0/components">281+ components</a>, you should add the respective maven dependency to the <code>pom.xml</code>. For example:</p>\n<pre class="language-xml"><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>project</span> <span class="token attr-name">xmlns</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://maven.apache.org/POM/4.0.0<span class="token punctuation">"</span></span> <span class="token attr-name"><span class="token namespace">xmlns:</span>xsi</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://www.w3.org/2001/XMLSchema-instance<span class="token punctuation">"</span></span>\n\t<span class="token attr-name"><span class="token namespace">xsi:</span>schemaLocation</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n\t...\n\t<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>dependencies</span><span class="token punctuation">></span></span>\n\t\t<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>dependency</span><span class="token punctuation">></span></span>\n\t\t\t<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>groupId</span><span class="token punctuation">></span></span>org.apache.camel<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>groupId</span><span class="token punctuation">></span></span>\n\t\t\t<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>artifactId</span><span class="token punctuation">></span></span>camel-amqp<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>artifactId</span><span class="token punctuation">></span></span>\n\t\t\t<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>version</span><span class="token punctuation">></span></span>${camel.version}<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>version</span><span class="token punctuation">></span></span>\n\t\t<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>dependency</span><span class="token punctuation">></span></span>\n\t...\n\t<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>dependencies</span><span class="token punctuation">></span></span>\n\t...\n<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>project</span><span class="token punctuation">></span></span>\n</code></pre>\n<h1>Testing</h1>\n<p>Testing is an important part of the development cycle, especially for the core components that have to work reliably in a production environment.<br>\nThe project includes example tests in the <code>src/test</code> folder:</p>\n<ul>\n<li><code>java</code><br>\ncontains the actual java unit tests that make use of <a href="https://github.com/apache/camel/blob/61a58836da57bab38ce719cbd1effd36253687a4/docs/user-manual/en/spring-testing.adoc"><code>CamelSpringTestSupport</code></a> to wire xml CamelContext configuration, test data and expected results together</li>\n<li><code>resources</code><br>\ncontains the spring xml configuration that is used by the java test classes and resamble the actual configurations from <code>src/main/resources</code></li>\n<li><code>data</code><br>\ncontains testdata for the data flows and the transformation</li>\n</ul>\n<p>Tests can easily be run from within an IDE (eclipse, visual code studio etc.) or via commandline</p>\n<pre class="language-bash"><code class="language-bash">mvn <span class="token function">test</span>\n</code></pre>\n<p>You will see the output of the test runs. If it looks like this, it works as expected:</p>\n<pre class="language-bash"><code class="language-bash">Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.846 sec\n\nResults <span class="token keyword">:</span>\n\nTests run: 3, Failures: 0, Errors: 0, Skipped: 0\n\n<span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> ------------------------------------------------------------------------\n<span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> BUILD SUCCESS\n<span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> ------------------------------------------------------------------------\n<span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> Total time: 32.267 s\n<span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> Finished at: 2018-04-09T15:25:25+02:00\n<span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> Final Memory: 25M/85M\n<span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> ------------------------------------------------------------------------\n</code></pre>\n<h1>Summary</h1>\n<p>The provided camel project template facilitates the creation of simple connectors. You can download it, modify or extend it, package the integrator to a zip file and deploy it on a target server. The included scripts help registering the integrator as an operating system service to run 24/7.</p>\n',url:"/blog/2018/9/4/Template-for-PPMP-transformation",title:"PPMP Use Cases: Template for PPMP transformation",date:new Date(15360192e5),tags:["use cases"],prev:{url:"/blog/2018/3/26/Release-0.2.0",title:"Unide 0.2.0 released"},next:{url:"/blog/2019/3/1/Version-3",title:"PPMP Version 3 release candidate"}}}],error:null,serverRendered:!0}</script><script src="/unide/files/c90543b978064b5f2c13.js" defer></script><script src="/unide/files/c3e469380ccd51a92bb6.js" defer></script><script src="/unide/files/c01c4654e10f48ab3d43.js" defer></script><script src="/unide/files/77dcc0254c88ffffb5bd.js" defer></script> |
| </body> |
| </html> |