You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by ranarula <ra...@gmail.com> on 2010/03/01 13:06:24 UTC
handle exception with servicemix-http bc
I am using the <http:provider /> bc with a custom marshaler to interact with
another system, S1
I am sending the message to S1 and expects a standard response from S1 based
on which I update the DB as SUCCESS
here is the EIP config
<eip:pipeline service="e:HTTPPipe" endpoint="outBound">
<eip:transformer>
<eip:exchange-target service="e:RegGateway" /> <!-- connect to HTTP
endpoint-->
</eip:transformer>
<eip:target>
<eip:exchange-target service="e:RegAck" /> <!-- Handle acknowledgement
response-->
</eip:target>
</eip:pipeline>
http config
<http:provider
service="e:RegGateway"
endpoint="regOutbound"
locationURI="http://uri.test.tt"
marshaler ="#regMarshaler">
</http:provider>
RegAck is a bean SU to update database with the response received.
In the production mode the S1 could be down or unresponsive due to various
reason. In such a scenario I would want to set a RESEND in my database for
the corresponding message.
To accomplish this I am implementing the handleException() method in my
custom marshaler, regMarshaler and setting the exchange in error. here is
the code snippet from the regMarshaler
public void handleException(MessageExchange exchange, SmxHttpExchange
httpExchange, Throwable ex){
log.info("Some Exception " + ex.getMessage());
try{
Fault fault= exchange.createFault();
fault.setContent(exchange.getMessage("in").getContent());
exchange.setFault(fault);
exchange.setStatus(ExchangeStatus.ERROR);
log.info("fault created");
}
catch(Exception e){
log.info("unable to create fault");
}
}
I am then checking for fault in my Ackbean to check if the exchange was in
fault and handle it accordingly by setting the record as RESEND in my DB.
But isn't working.
Everytime I try to simulate a scenario it always gives a log entry as
WARN [SimpleEndpoint] SimpleEndpoint.fail called:
What should I do to handle the unknown issue with the http endpoint so that
I am able to update the corresponding record in DB as resend.
Thanks in advance.
--
View this message in context: http://old.nabble.com/handle-exception-with-servicemix-http-bc-tp27742660p27742660.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: handle exception with servicemix-http bc
Posted by ranarula <ra...@gmail.com>.
Aha got this one too to work finally.
Using an InOnly MEP was an issue. Changing it to InOut MEP and altering the
EIP did the trick.
--
View this message in context: http://old.nabble.com/handle-exception-with-servicemix-http-bc-tp27742660p27867794.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: handle exception with servicemix-http bc
Posted by ranarula <ra...@gmail.com>.
Any help on this will be deeply appreciated
--
View this message in context: http://old.nabble.com/handle-exception-with-servicemix-http-bc-tp27742660p27860227.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.