camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > Publish Subscribe Channel
Date Thu, 14 Apr 2011 13:10:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CAMEL/Publish+Subscribe+Channel">Publish
Subscribe Channel</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~davsclaus">Claus
Ibsen</a>
    </h4>
        <br/>
                         <h4>Changes (3)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-unchanged" >h3. Publish Subscribe Channel <br>
<br></td></tr>
            <tr><td class="diff-changed-lines" >Camel supports the [Publish Subscribe
Channel|http://www.enterpriseintegrationpatterns.com/PublishSubscribeChannel.html] from the
[EIP patterns|Enterprise Integration Patterns] using <span class="diff-added-words"style="background-color:
#dfd;">for example</span> the following <span class="diff-changed-words">components<span
class="diff-added-chars"style="background-color: #dfd;">:</span></span> <br></td></tr>
            <tr><td class="diff-unchanged" > <br>* [JMS] for working with
JMS Topics for high performance, clustering and load balancing <br>* [XMPP] when using
rooms for group communication <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">*
[SEDA] for working with SEDA in the same [CamelContext] which can work in pub-sub, but allowing
multiple consumers. <br>* [VM] as SEDA but for intra-JVM. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>!http://www.enterpriseintegrationpatterns.com/img/PublishSubscribeSolution.gif!
<br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>*Using the [Fluent Builders]*
<br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">{snippet:id=e8|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java}</span>
<span class="diff-added-words"style="background-color: #dfd;">{snippet:id=multicast|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java}</span>
<br></td></tr>
            <tr><td class="diff-unchanged" > <br>*Using the [Spring XML
Extensions]* <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h3><a name="PublishSubscribeChannel-PublishSubscribeChannel"></a>Publish
Subscribe Channel</h3>

<p>Camel supports the <a href="http://www.enterpriseintegrationpatterns.com/PublishSubscribeChannel.html"
class="external-link" rel="nofollow">Publish Subscribe Channel</a> from the <a
href="/confluence/display/CAMEL/Enterprise+Integration+Patterns" title="Enterprise Integration
Patterns">EIP patterns</a> using for example the following components:</p>

<ul>
	<li><a href="/confluence/display/CAMEL/JMS" title="JMS">JMS</a> for working
with JMS Topics for high performance, clustering and load balancing</li>
	<li><a href="/confluence/display/CAMEL/XMPP" title="XMPP">XMPP</a> when
using rooms for group communication</li>
	<li><a href="/confluence/display/CAMEL/SEDA" title="SEDA">SEDA</a> for
working with SEDA in the same <a href="/confluence/display/CAMEL/CamelContext" title="CamelContext">CamelContext</a>
which can work in pub-sub, but allowing multiple consumers.</li>
	<li><a href="/confluence/display/CAMEL/VM" title="VM">VM</a> as SEDA but
for intra-JVM.</li>
</ul>


<p><span class="image-wrap" style=""><img src="http://www.enterpriseintegrationpatterns.com/img/PublishSubscribeSolution.gif"
style="border: 0px solid black" /></span></p>

<h4><a name="PublishSubscribeChannel-UsingRoutingLogic"></a>Using Routing
Logic</h4>

<p>Another option is to explicitly list the publish-subscribe relationship in your routing
logic; this keeps the producer and consumer decoupled but lets you control the fine grained
routing configuration using the <a href="/confluence/display/CAMEL/DSL" title="DSL">DSL</a>
or <a href="/confluence/display/CAMEL/Xml+Configuration" title="Xml Configuration">Xml
Configuration</a>.</p>

<p><b>Using the <a href="/confluence/display/CAMEL/Fluent+Builders" title="Fluent
Builders">Fluent Builders</a></b></p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">RouteBuilder builder = <span class="code-keyword">new</span>
RouteBuilder() {
    <span class="code-keyword">public</span> void configure() {
        errorHandler(deadLetterChannel(<span class="code-quote">"mock:error"</span>));

        from(<span class="code-quote">"seda:a"</span>)
            .multicast().to(<span class="code-quote">"seda:b"</span>, <span
class="code-quote">"seda:c"</span>, <span class="code-quote">"seda:d"</span>);
    }
};
</pre>
</div></div>

<p><b>Using the <a href="/confluence/display/CAMEL/Spring+XML+Extensions" title="Spring
XML Extensions">Spring XML Extensions</a></b></p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml"><span class="code-tag">&lt;camelContext errorHandlerRef=<span
class="code-quote">"errorHandler"</span> xmlns=<span class="code-quote">"http://camel.apache.org/schema/spring"</span>&gt;</span>
    <span class="code-tag">&lt;route&gt;</span>
        <span class="code-tag">&lt;from uri=<span class="code-quote">"seda:a"</span>/&gt;</span>
        <span class="code-tag">&lt;multicast&gt;</span>
            <span class="code-tag">&lt;to uri=<span class="code-quote">"seda:b"</span>/&gt;</span>
            <span class="code-tag">&lt;to uri=<span class="code-quote">"seda:c"</span>/&gt;</span>
            <span class="code-tag">&lt;to uri=<span class="code-quote">"seda:d"</span>/&gt;</span>
        <span class="code-tag">&lt;/multicast&gt;</span>
    <span class="code-tag">&lt;/route&gt;</span>
<span class="code-tag">&lt;/camelContext&gt;</span>
</pre>
</div></div>

<h4><a name="PublishSubscribeChannel-UsingThisPattern"></a>Using This Pattern</h4>

<p>If you would like to use this EIP Pattern then please read the <a href="/confluence/display/CAMEL/Getting+Started"
title="Getting Started">Getting Started</a>, you may also find the <a href="/confluence/display/CAMEL/Architecture"
title="Architecture">Architecture</a> useful particularly the description of <a
href="/confluence/display/CAMEL/Endpoint" title="Endpoint">Endpoint</a> and <a
href="/confluence/display/CAMEL/URIs" title="URIs">URIs</a>. Then you could try out
some of the <a href="/confluence/display/CAMEL/Examples" title="Examples">Examples</a>
first before trying this pattern out.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/Publish+Subscribe+Channel">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=52149&revisedVersion=8&originalVersion=7">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/Publish+Subscribe+Channel?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message