You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by da...@cocoon.zones.apache.org on 2008/08/17 20:40:14 UTC

[DAISY] Updated: JMSPublisherAction

A document has been updated:

http://cocoon.zones.apache.org/daisy/documentation/1500.html

Document ID: 1500
Branch: main
Language: default
Name: JMSPublisherAction (unchanged)
Document Type: Sitemap Component (unchanged)
Updated on: 8/17/08 6:39:56 PM
Updated by: Lukas Lang

A new version has been created, state: draft

Parts
=====

Long description
----------------
This part has been added.
Mime type: text/xml
File name: null
Size: 2546 bytes
Content:
<html>
<body>

<p>JMSPublisherAction is based on AbstractMessagePublisher and used as a sitemap
action to send simple JMS (Java Message Service) text messages to an injected
destination, which could either be a topic or a queue. The message must be
provided as a sitemap parameter.</p>

<h3>Example</h3>

<p>Assuming, we run the following sitemap on a Cocoon web application:</p>

<pre>&lt;map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"&gt;
  &lt;map:components&gt;
    &lt;map:pipes default="caching"&gt;
      &lt;map:pipe logger="core.sitemap" name="event-aware" src="org.apache.cocoon.components.pipeline.impl.CachingProcessingPipeline"&gt;
        &lt;parameter name="cache-role" value="org.apache.cocoon.caching.Cache/EventAware" /&gt;
      &lt;/map:pipe&gt;
    &lt;/map:pipes&gt;
  &lt;/map:components&gt;
  &lt;map:pipelines&gt;
    &lt;map:pipeline type="event-aware"&gt;
      &lt;map:match pattern="action"&gt;
        &lt;map:act type="JMSPublisherAction"&gt;
          &lt;map:parameter name="message" value="{request-param:event}" /&gt;
        &lt;/map:act&gt;
        ...
      &lt;/map:match&gt;
    &lt;/map:pipeline&gt;
  &lt;/map:pipelines&gt;
&lt;/map:sitemap&gt;</pre>

<p>As a request matches the pattern <em>action</em>, &lt;map:act /&gt; is
called. The request must provide the parameter event. Saying, the URL looks as
follows:</p>

<pre>http://localhost:8080/cocoon-jms-sample/action?event=one</pre>

<p>A text message will be created and sent to the provided destination. This
sample is part of the cocoon-jms-sample block, using JMS messages for content
invalidation of an EventAware cache.</p>

<h3>Configuration</h3>

<p>The action is configured, using Spring's dependency injection mechanism. In
this example, we gain benefit of using Spring's JMS capabilities, which provide
a template for message posting and delivery via callback interface. Please see
the JMS <a href="daisy:1501">sample</a> block for further information, which
uses <a href="http://activemq.apache.org">ActiveMQ</a> as an embedded message
broker.</p>

<pre>  &lt;!-- Action bean --&gt;
  &lt;bean name="org.apache.cocoon.acting.Action/JMSPublisherAction"
    class="org.apache.cocoon.acting.JMSPublisherAction" scope="prototype"&gt;
    &lt;property name="template" ref="org.apache.cocoon.jms.sample.myJmsTemplate" /&gt;
    &lt;property name="destination" ref="org.apache.cocoon.jms.sample.topic"/&gt;
  &lt;/bean&gt;
</pre>

</body>
</html>


Fields
======
CocoonComponentReference: Action (new field)
CocoonBlock: jms (new field)
FQ Java class: org.apache.cocoon.acting.JMSPublisherAction (new field)