1 16 package org.apache.cocoon.acting; 17 18 import java.util.Collections ; 19 import java.util.Map ; 20 21 import javax.jms.Message ; 22 23 import org.apache.avalon.framework.parameters.Parameters; 24 import org.apache.avalon.framework.thread.ThreadSafe; 25 import org.apache.cocoon.environment.Redirector; 26 import org.apache.cocoon.environment.SourceResolver; 27 28 import org.apache.cocoon.components.jms.AbstractMessagePublisher; 29 30 53 public class JMSPublisherAction extends AbstractMessagePublisher implements Action, ThreadSafe { 54 55 57 private static final String MESSAGE_PARAM = "message"; 58 59 61 public JMSPublisherAction () { 62 } 63 64 66 public Map act(Redirector redirector, 67 SourceResolver resolver, 68 Map objectModel, 69 String source, 70 Parameters parameters) throws Exception { 71 72 Map result = null; 73 try { 74 final String event = parameters.getParameter(MESSAGE_PARAM); 76 final Message message = m_session.createTextMessage(event); 77 publishMessage(message); 78 result = Collections.EMPTY_MAP; 79 } catch (Exception e) { 80 if (getLogger().isWarnEnabled()) { 81 getLogger().warn("Error delivering message.", e); 82 } 83 } 84 85 return result; 86 } 87 88 } 89 | Popular Tags |