camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > Templating
Date Fri, 05 Feb 2010 07:18:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/CAMEL/Templating">Templating</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~davsclaus">Claus
Ibsen</a>
    </h4>
     
          <br/>
     <div class="notificationGreySide">
         <h2><a name="Templating-Templating"></a>Templating</h2>

<p>When you are testing distributed systems its a very common requirement to have to
stub out certain external systems with some stub so that you can test other parts of the system
until a specific system is available or written etc.</p>

<p>A great way to do this is using some kind of Template system to generate responses
to requests generating a dynamic message using a mostly-static body.</p>

<p>There are a number of templating components you could use</p>

<ul>
	<li><a href="/confluence/display/CAMEL/Freemarker" title="Freemarker">Freemarker</a></li>
	<li><a href="/confluence/display/CAMEL/Scalate" title="Scalate">Scalate</a></li>
	<li><a href="/confluence/display/CAMEL/StringTemplate" title="StringTemplate">StringTemplate</a></li>
	<li><a href="/confluence/display/CAMEL/Velocity" title="Velocity">Velocity</a></li>
	<li><a href="/confluence/display/CAMEL/XQuery" title="XQuery">XQuery</a></li>
	<li><a href="/confluence/display/CAMEL/XSLT" title="XSLT">XSLT</a></li>
</ul>


<h3><a name="Templating-Example"></a>Example</h3>

<p>Here's a simple example showing how we can respond to InOut requests on the <b>My.Queue</b>
queue on <a href="/confluence/display/CAMEL/ActiveMQ" title="ActiveMQ">ActiveMQ</a>
with a template generated response. The reply would be sent back to the JMSReplyTo Destination.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
from(<span class="code-quote">"activemq:My.Queue"</span>).
  to(<span class="code-quote">"velocity:com/acme/MyResponse.vm"</span>);
</pre>
</div></div>

<p>If you want to use InOnly and consume the message and send it to another destination
you could use</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
from(<span class="code-quote">"activemq:My.Queue"</span>).
  to(<span class="code-quote">"velocity:com/acme/MyResponse.vm"</span>).
  to(<span class="code-quote">"activemq:Another.Queue"</span>);
</pre>
</div></div>

<h3><a name="Templating-SeeAlso"></a>See Also</h3>

<ul>
	<li><a href="/confluence/display/CAMEL/Mock" title="Mock">Mock</a> for
details of mock endpoint testing (as opposed to template based stubs).</li>
</ul>

     </div>
     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/CAMEL/Templating">View Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=67659&revisedVersion=6&originalVersion=5">View
Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/CAMEL/Templating?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message