Hi,
I migrated to ServiceMix 3.3.2 and did more research on the in-only
scenario.
What I found out is that at the end of the exchange the status of the
exchange is DONE from the point of view of the Jms consumer, so the message
is committed.
Setting a break point in AbstractConsumerEndpoint.processExchange() method.
protected void processExchange(final MessageExchange exchange, final Session
session, final JmsContext context) throws Exception {
if (exchange instanceof InOnly) {
if ((ExchangeStatus.ERROR.equals(exchange.getStatus()))
&& marshaler instanceof DefaultConsumerMarshaler
&&
((DefaultConsumerMarshaler)marshaler).isRollbackOnError()) {
throw exchange.getError();
}
// For InOnly exchanges, ignore DONE exchanges or those where
isRollbackOnError is false
return;
}
Whe the break point is hit this method will return without throwing an
exception or sending the reply message because the exchange is InOnly as
expected and has a DONE status.
Now, I would like to know if what I am trying to do (i.e get the exchange
ERROR status propagated to the Jms consumer to trigger an exception and a
rollback) is acheivable at all, and this case pointers as to how would be
welcomed or if I my goal is not reachable with ServiceMix 3.2.2.
Thanks in advance,
Philippe Renon.
Philippe Renon wrote:
>
> Hi,
>
> I am trying to build a robust Jms to mail bridge with ServiceMix 3.3.1 and
> I am encountering the following difficulties.
>
> When using an InOnly MEP, if the mail connection fails (because of an
> incorrect connection string for example) an error is generated but the JMS
> message is consumed anyways (i.e. no rollback).
>
> ERROR - MailComponent - Error sending mail...
> javax.mail.AuthenticationFailedException
> at javax.mail.Service.connect(Service.java:306)
> at
> org.apache.servicemix.mail.MailSenderEndpoint.processInOnly(MailSenderEndpoint.java:117)
> at
> org.apache.servicemix.common.endpoints.ProviderEndpoint.process(ProviderEndpoint.java:102)
> at
> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:627)
> at
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:581)
> at
> org.apache.servicemix.common.AsyncBaseLifeCycle.onMessageExchange(AsyncBaseLifeCycle.java:535)
> at
> org.apache.servicemix.common.SyncLifeCycleWrapper.onMessageExchange(SyncLifeCycleWrapper.java:60)
> at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:623)
> at
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
> at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:168)
> at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
> at java.lang.Thread.run(Thread.java:595)
> ERROR - MailComponent - Error processing exchange InOnly[
> id: ID:10.244.140.130-128c9c24ae8-7:6
> status: Active
> role: provider
> service: {http://com.sungard.decalog/jms2mail}mail
> endpoint: endpoint
> in: <?xml version="1.0" encoding="UTF-8"?><message>hello</message>
> ]
>
> When switching to a RobustInOnly MEP, the above problem is solved but the
> Jms consumer service is requested to send a reply message.
> Since I did not configure a reply destination, there is an error leading
> to a rollback and the Jms message is returned to the queue (although a
> mail was sent...).
> I could create a dummy reply destination but this would require additional
> and, in my particular use case useless, configuration and setup.
>
> Here is the JMS Consumer service definition:
>
> <jms:consumer service="jms2mail:jms"
> endpoint="endpoint"
> targetService="jms2mail:pipeline"
> destinationName="sims.jms.EventPartnerQueue"
> connectionFactory="#connectionFactory"
> destinationResolver="#destinationResolver"
> marshaler="#marshaler"
> listenerType="default"
> transacted="jms"
> cacheLevel="3"
> concurrentConsumers="1"
> />
>
> <bean id="marshaler"
> class="com.sungard.decalog.servicemix.jms2mail.MyConsumerMarshaler">
> <property name="mep"
> value="http://www.w3.org/2004/08/wsdl/in-only" />
> </bean>
>
> The MyConsumerMarshaller class extends DefaultConsumerMarshaler and
> overrides the populateMessage() method to accept plain (non XML) message
> payloads.
>
>
> The eip service definition (doesn't do much for now):
>
> <eip:static-recipient-list service="jms2mail:pipeline"
> endpoint="endpoint">
> <eip:recipients>
> <eip:exchange-target service="jms2mail:mail"
> endpoint="endpoint" />
> </eip:recipients>
> </eip:static-recipient-list>
>
>
> The mail service definition:
>
> <mail:sender service="jms2mail:mail"
> endpoint="endpoint"
> sender="${mail.sender}"
> receiver="${mail.receiver}"
> connection="${mail.connection}" >
>
> <mail:ignoreMessageProperties>
> <value
> type="java.lang.String">org.apache.servicemix.mail.to</value>
> <value
> type="java.lang.String">org.apache.servicemix.mail.bcc</value>
> <value
> type="java.lang.String">org.apache.servicemix.mail.cc</value>
> </mail:ignoreMessageProperties>
>
> </mail:sender>
>
>
> My question is how would one achieve a robust in only Jms to mail bridge
> without reply messages.
>
> Regards,
> Philippe.
>
>
>
>
>
--
View this message in context:
http://old.nabble.com/How-to-create-a-robust-Jms-to-mail-bridge-tp28655521p28693674.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.