Spring AMQP Outbound Adapter behavior when exchange not found - spring

I have a spring integration code that connects a JMS listener (that listens to a mq series local queue)
<int-jms:message-driven-channel-adapter>
and forwards the message to a rabbitmq (not controlled by me) via a
<int-amqp:outbound-channel-adapter>
I am trying to keep this transactional meaning that if the rabbitmq did not receive the message I want to keep it in the MQ series local queue.
However I noticed that if the exchange that was mentioned in the rabbitmq configurations did not exist I see in my logs this line:
ERROR (CachingConnectionFactory.java:292) - Channel shutdown: channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no exchange 'xxx' in vhost 'xxx', class-id=60, method-id=40)
But my message disappears for the mq series local queue.
What shall i do do make it retry to send the message if the rabbitmq broker fails or if the exchange does not exists?
Thanks for your help,
My configuration:
<int-jms:message-driven-channel-adapter
id="x.y.z" channel="channel-in"
error-channel="errorChannel" header-mapper="jmsIntegrationHeaderMapper"
acknowledge="transacted" destination-name="a.b.c" />
<int:channel id="channel-in">
</int:channel>
<int:header-enricher input-channel="channel-in"
output-channel="channel-out">
<int:header name="url"
expression="'amqp://${amqp.user}#${amqp.host}:${amqp.port}/${amqp.vhost}'"></int:header>
</int:header-enricher>
<int:channel id="channel-out">
</int:channel>
<int-amqp:outbound-channel-adapter
channel="channel-out" amqp-template="amqpTemplate"
routing-key="crd" mapped-request-headers="*" exchange-name="${amqp.exchange}">
</int-amqp:outbound-channel-adapter>
<rabbit:connection-factory id="amqpConnectionFactory" addresses="${amqp.host}:${amqp.port}"
cache-mode="CONNECTION"
channel-cache-size="25"
username="${amqp.user}"
password="${amqp.pass}"
virtual-host="${amqp.vhost}"/>
<rabbit:template id="amqpTemplate"
connection-factory="amqpConnectionFactory" mandatory="true" channel-transacted="true"/>

Unlike JMS, publishing to RabbitMQ is asynchronous (which is why it's generally faster), so the failure for a missing exchange is reported on a different thread; you can add a listener to get the notification instead of it just being logged.
You can enable transactions template.setChannelTransacted(true); and then the failure will be reported on the publishing thread because it will be blocked waiting for the reply from the txCommit() when the IO error occurs.
However, transactions are quite expensive so can hurt performance.
For other errors (e.g. exchange exists, but no route to a queue), you can use publisher confirms and returns but, again, waiting for a confirmation for each individual message published will slow down performance.
EDIT
You should get an exception on txCommit.
Caused by: org.springframework.amqp.AmqpIOException: java.io.IOException
at org.springframework.amqp.rabbit.connection.RabbitUtils.commitIfNecessary(RabbitUtils.java:107) ~[spring-rabbit-2.0.2.BUILD-SNAPSHOT.jar:2.0.2.BUILD-SNAPSHOT]
at org.springframework.amqp.rabbit.core.RabbitTemplate.doSend(RabbitTemplate.java:2003) ~[spring-rabbit-2.0.2.BUILD-SNAPSHOT.jar:2.0.2.BUILD-SNAPSHOT]
at org.springframework.amqp.rabbit.core.RabbitTemplate.lambda$send$3(RabbitTemplate.java:865) ~[spring-rabbit-2.0.2.BUILD-SNAPSHOT.jar:2.0.2.BUILD-SNAPSHOT]
at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1841) ~[spring-rabbit-2.0.2.BUILD-SNAPSHOT.jar:2.0.2.BUILD-SNAPSHOT]
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1784) ~[spring-rabbit-2.0.2.BUILD-SNAPSHOT.jar:2.0.2.BUILD-SNAPSHOT]
at org.springframework.amqp.rabbit.core.RabbitTemplate.send(RabbitTemplate.java:864) ~[spring-rabbit-2.0.2.BUILD-SNAPSHOT.jar:2.0.2.BUILD-SNAPSHOT]
at org.springframework.amqp.rabbit.core.RabbitTemplate.convertAndSend(RabbitTemplate.java:927) ~[spring-rabbit-2.0.2.BUILD-SNAPSHOT.jar:2.0.2.BUILD-SNAPSHOT]
at org.springframework.amqp.rabbit.core.RabbitTemplate.convertAndSend(RabbitTemplate.java:921) ~[spring-rabbit-2.0.2.BUILD-SNAPSHOT.jar:2.0.2.BUILD-SNAPSHOT]
at com.example.So47454769Application.lambda$0(So47454769Application.java:29) [classes/:na]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:780) [spring-boot-2.0.0.M7.jar:2.0.0.M7]
... 5 common frames omitted
Caused by: java.io.IOException: null
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:126) ~[amqp-client-5.0.0.jar:5.0.0]
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:122) ~[amqp-client-5.0.0.jar:5.0.0]
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:144) ~[amqp-client-5.0.0.jar:5.0.0]
at com.rabbitmq.client.impl.ChannelN.txCommit(ChannelN.java:1519) ~[amqp-client-5.0.0.jar:5.0.0]
at com.rabbitmq.client.impl.ChannelN.txCommit(ChannelN.java:52) ~[amqp-client-5.0.0.jar:5.0.0]
at org.springframework.amqp.rabbit.support.PublisherCallbackChannelImpl.txCommit(PublisherCallbackChannelImpl.java:588) ~[spring-rabbit-2.0.2.BUILD-SNAPSHOT.jar:2.0.2.BUILD-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_181]
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory$CachedChannelInvocationHandler.invoke(CachingConnectionFactory.java:981) ~[spring-rabbit-2.0.2.BUILD-SNAPSHOT.jar:2.0.2.BUILD-SNAPSHOT]
at com.sun.proxy.$Proxy60.txCommit(Unknown Source) ~[na:na]
at org.springframework.amqp.rabbit.connection.RabbitUtils.commitIfNecessary(RabbitUtils.java:104) ~[spring-rabbit-2.0.2.BUILD-SNAPSHOT.jar:2.0.2.BUILD-SNAPSHOT]
... 14 common frames omitted
Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no exchange 'junk' in vhost '/', class-id=60, method-id=40)
at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66) ~[amqp-client-5.0.0.jar:5.0.0]
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:36) ~[amqp-client-5.0.0.jar:5.0.0]
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:494) ~[amqp-client-5.0.0.jar:5.0.0]
at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:288) ~[amqp-client-5.0.0.jar:5.0.0]
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:138) ~[amqp-client-5.0.0.jar:5.0.0]
... 24 common frames omitted
Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no exchange 'junk' in vhost '/', class-id=60, method-id=40)
at com.rabbitmq.client.impl.ChannelN.asyncShutdown(ChannelN.java:504) ~[amqp-client-5.0.0.jar:5.0.0]
at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:346) ~[amqp-client-5.0.0.jar:5.0.0]
at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:178) ~[amqp-client-5.0.0.jar:5.0.0]
at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:111) ~[amqp-client-5.0.0.jar:5.0.0]
at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:643) ~[amqp-client-5.0.0.jar:5.0.0]
at com.rabbitmq.client.impl.AMQConnection.access$300(AMQConnection.java:47) ~[amqp-client-5.0.0.jar:5.0.0]
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:581) ~[amqp-client-5.0.0.jar:5.0.0]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_181]

Related

How to set a timeout on a POST request using Spring RestTemplate?

I want to set a timeout on the process of sending a POST request via Spring RestTemplate. For example, if request is not finished within X sec for whatever reasons, I want it to throw an exception and stop execution/release resources, if possible.
Initially, I tried to use a HttpComponentsClientHttpRequestFactory, but didn't succeed and degraded to SimpleClientHttpRequestFactory. Now I just want to make it work with SimpleClientHttpRequestFactory in all cases and then try a more complex solution.
I have the following configuration:
#Bean
public RestTemplate restTemplate() {
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(3_000);
requestFactory.setReadTimeout(30_000);
return new RestTemplate(requestFactory);
}
The I use it as follows:
HttpHeaders headers = new HttpHeaders();
headers.set("Content-Type", "text/xml;charset=UTF-8");
HttpEntity<String> requestEntity = new HttpEntity<>(xmlMsgAsString, headers);
ResponseEntity<String> response = restTemplate.postForEntity(url, requestEntity, String.class);
I have one destination server, which is currently unreachable, and I have a bunch of XML messages that I need to POST to this server. With the code as above, for majority of messages it works as expected, it throws the following exception after 30 sec:
org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://X:Y/Z": Read timed out; nested exception is java.net.SocketTimeoutException: Read timed out
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:744)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:670)
at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:445)
...
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:171)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:735)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1593)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at org.springframework.http.client.SimpleClientHttpResponse.getRawStatusCode(SimpleClientHttpResponse.java:55)
at org.springframework.web.client.DefaultResponseErrorHandler.hasError(DefaultResponseErrorHandler.java:55)
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:766)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:736)
... 18 common frames omitted
However, for one particular message it's stuck for ~955 secs and then throws the following exception:
org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://X:Y/Z": Unexpected end of file from server; nested exception is java.net.SocketException: Unexpected end of file from server
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:744)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:670)
at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:445)
...
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:851)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1593)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at org.springframework.http.client.SimpleClientHttpResponse.getRawStatusCode(SimpleClientHttpResponse.java:55)
at org.springframework.web.client.DefaultResponseErrorHandler.hasError(DefaultResponseErrorHandler.java:55)
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:766)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:736)
... 26 common frames omitted
The previous successfully thrown after 30 sec messages and the last one are similar XML messages and destination is the same. The only difference I thought of was the size of messages, the last one is ~204KB, while all previous ones are much smaller. Why the last exception occurs and how to set time restriction on this case?
Spring Boot 2.1.10 running on Jetty

Failed to send message back on synchronous queue (Timer already cancelled)

We are using a single broker ActiveMQ (5.10.2). After having some problems caused by slow consumers, we had to restart ActiveMQ.
Since we restarted it, we have these warning logs on the broker side :
2020-06-12 10:40:20,232 | WARN | Failed to register MBean org.apache.activemq:type=Broker,brokerName=customer-prod,destinationType=Queue,destinationName=PROD.CORE.GET.Q.REPLY | org.apache.activemq.broker.jmx.ManagedRegionBroker | ActiveMQ Transport: tcp:///ip:53068#61616
Regularly, we send messages synchronously on the queue PROD.CORE.GET and the JMS consumer (connected through HTTP) sends the response back on the queue PROD.CORE.GET.Q.REPLY.
As soon as the JMS consumer responds, we get this following error and the response is never sent to the broker :
2020-06-12 08:29:54,802 [WARN ] [] - Execution of JMS message listener failed. Caused by: [org.apache.camel.RuntimeCamelException - org.springframework.jms.UncategorizedJmsException: Uncategorized exception occurred during JMS processing; nested exception is javax.jms.JMSException: Timer already cancelled.]
org.apache.camel.RuntimeCamelException: org.springframework.jms.UncategorizedJmsException: Uncategorized exception occurred during JMS processing; nested exception is javax.jms.JMSException: Timer already cancelled.
at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1826) ~[camel-core-2.24.1.jar:2.24.1]
at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:134) ~[camel-jms-2.24.1.jar:2.24.1]
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:736) ~[spring-jms-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:696) ~[spring-jms-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:674) ~[spring-jms-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:318) [spring-jms-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:257) [spring-jms-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1190) [spring-jms-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1180) [spring-jms-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1077) [spring-jms-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_60]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]
Caused by: org.springframework.jms.UncategorizedJmsException: Uncategorized exception occurred during JMS processing; nested exception is javax.jms.JMSException: Timer already cancelled.
at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:311) ~[spring-jms-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:185) ~[spring-jms-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:507) ~[spring-jms-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:556) ~[camel-jms-2.24.1.jar:2.24.1]
at org.apache.camel.component.jms.EndpointMessageListener.sendReply(EndpointMessageListener.java:370) ~[camel-jms-2.24.1.jar:2.24.1]
at org.apache.camel.component.jms.EndpointMessageListener$EndpointMessageListenerAsyncCallback.done(EndpointMessageListener.java:223) ~[camel-jms-2.24.1.jar:2.24.1]
at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:117) ~[camel-jms-2.24.1.jar:2.24.1]
... 11 common frames omitted
Caused by: javax.jms.JMSException: Timer already cancelled.
at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:54) ~[activemq-client-5.15.10.jar:5.15.10]
at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1403) ~[activemq-client-5.15.10.jar:5.15.10]
at org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1972) ~[activemq-client-5.15.10.jar:5.15.10]
at org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:288) ~[activemq-client-5.15.10.jar:5.15.10]
at org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:223) ~[activemq-client-5.15.10.jar:5.15.10]
at org.apache.activemq.jms.pool.PooledProducer.send(PooledProducer.java:95) ~[activemq-jms-pool-5.15.10.jar:5.15.10]
at org.apache.activemq.jms.pool.PooledProducer.send(PooledProducer.java:66) ~[activemq-jms-pool-5.15.10.jar:5.15.10]
at org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:634) ~[spring-jms-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.doSend(JmsConfiguration.java:634) ~[camel-jms-2.24.1.jar:2.24.1]
at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.doSendToDestination(JmsConfiguration.java:573) ~[camel-jms-2.24.1.jar:2.24.1]
at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.access$100(JmsConfiguration.java:515) ~[camel-jms-2.24.1.jar:2.24.1]
at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate$4.doInJms(JmsConfiguration.java:558) ~[camel-jms-2.24.1.jar:2.24.1]
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:504) ~[spring-jms-5.1.10.RELEASE.jar:5.1.10.RELEASE]
... 15 common frames omitted
Caused by: java.lang.IllegalStateException: Timer already cancelled.
at java.util.Timer.sched(Timer.java:397) ~[na:1.8.0_60]
at java.util.Timer.schedule(Timer.java:248) ~[na:1.8.0_60]
at org.apache.activemq.thread.Scheduler.executePeriodically(Scheduler.java:41) ~[activemq-client-5.15.10.jar:5.15.10]
at org.apache.activemq.broker.region.Queue.start(Queue.java:1039) ~[na:na]
at org.apache.activemq.broker.region.AbstractRegion.addDestination(AbstractRegion.java:141) ~[na:na]
at org.apache.activemq.broker.region.RegionBroker.addDestination(RegionBroker.java:334) ~[na:na]
at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:172) ~[na:na]
at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:172) ~[na:na]
at org.apache.activemq.broker.MutableBrokerFilter.addDestination(MutableBrokerFilter.java:177) ~[na:na]
at org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:172) ~[na:na]
at org.apache.activemq.broker.MutableBrokerFilter.addDestination(MutableBrokerFilter.java:177) ~[na:na]
at org.apache.activemq.broker.region.RegionBroker.send(RegionBroker.java:448) ~[na:na]
at org.apache.activemq.broker.jmx.ManagedRegionBroker.send(ManagedRegionBroker.java:297) ~[na:na]
at org.apache.activemq.broker.CompositeDestinationBroker.send(CompositeDestinationBroker.java:96) ~[na:na]
at org.apache.activemq.broker.TransactionBroker.send(TransactionBroker.java:307) ~[na:na]
at org.apache.activemq.broker.MutableBrokerFilter.send(MutableBrokerFilter.java:157) ~[na:na]
at org.apache.activemq.broker.util.TimeStampingBrokerPlugin.send(TimeStampingBrokerPlugin.java:131) ~[na:na]
at org.apache.activemq.broker.BrokerFilter.send(BrokerFilter.java:152) ~[na:na]
at org.apache.activemq.broker.MutableBrokerFilter.send(MutableBrokerFilter.java:157) ~[na:na]
at org.apache.activemq.broker.TransportConnection.processMessage(TransportConnection.java:541) ~[na:na]
Since it was an emergency to solve the problem, we tried to restart ActiveMQ again and the problem seems to be solved (all previous warn and error logs disappeared immediately).
We would like to know what happened but I cannot find any relevant answer on the web. That's why I am asking for help ! :)
Thanks in advance.

Exception in publishing message through GCP pubsub

I am trying to publish message using gcp pubsub, but getting below exception at publishers end. While sending message through pubsuboutboundgatewayinterface this exception is happing.
2019-12-19 18:47:27.408 WARN 2856 --- [pool-1-thread-2] o.s.c.g.p.c.p.PubSubPublisherTemplate : Publishing to topic_name topic failed.
com.google.api.gax.rpc.UnavailableException: io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
at com.google.api.gax.rpc.ApiExceptionFactory.createException(ApiExceptionFactory.java:69)
at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:72)
at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:60)
at com.google.api.gax.grpc.GrpcExceptionCallable$ExceptionTransformingFuture.onFailure(GrpcExceptionCallable.java:97)
at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:68)
at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1070)
at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:30)
at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:1138)
at com.google.common.util.concurrent.AbstractFuture.addListener(AbstractFuture.java:707)
at com.google.common.util.concurrent.ForwardingListenableFuture.addListener(ForwardingListenableFuture.java:45)
at com.google.api.core.ApiFutureToListenableFuture.addListener(ApiFutureToListenableFuture.java:52)
at com.google.common.util.concurrent.Futures.addCallback(Futures.java:1051)
at com.google.api.core.ApiFutures.addCallback(ApiFutures.java:63)
at com.google.api.gax.grpc.GrpcExceptionCallable.futureCall(GrpcExceptionCallable.java:67)
at com.google.api.gax.rpc.AttemptCallable.call(AttemptCallable.java:81)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
at io.grpc.Status.asRuntimeException(Status.java:526)
at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:482)
at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
at io.grpc.internal.CensusStatsModule$StatsClientInterceptor$1$1.onClose(CensusStatsModule.java:678)
at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
at io.grpc.internal.CensusTracingModule$TracingClientInterceptor$1$1.onClose(CensusTracingModule.java:397)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:459)
at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:63)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:546)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$600(ClientCallImpl.java:467)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:584)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
... 7 common frames omitted
Caused by: java.io.IOException: An existing connection was forcibly closed by the remote host
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:192)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
at io.grpc.netty.shaded.io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
at io.grpc.netty.shaded.io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1128)
at io.grpc.netty.shaded.io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
at io.grpc.netty.shaded.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:644)
at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:579)
at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:496)
at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:458)
at io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897)
at io.grpc.netty.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
... 1 common frames omitted
Is it some port issue ? I am doing this for first time. Can anyone please help.

JMS Connection is closed with Spring Boot

I use Spring Boot 1.2.3-RELEASE with ActiveMQ 5.11.1.
I have configured JMS with the following:
spring:
activemq:
inMemory: false
broker-url: tcp://localhost:61616?wireFormat.maxInactivityDurationInitalDelay=30000
And I send messages like this:
jmsTemplate.send(Queues.BULK_LOAD_BYINSERT_FILE, new MessageCreator() {
#Override
public Message createMessage(javax.jms.Session session) throws JMSException {
log.info("******** SEND BULK_LOAD_BYINSERT: {}", file.getName());
return session.createObjectMessage(file);
}
});
When I send messages once in a while I will get the following ERROR. I have no idea how I could avoid this problem, and how I could detect where is the connection closed. Would anyone have an suggestion how I could proceed to avoid this?
Thanks for your help.
2015-05-18 17:48:19.305 ERROR 27713 --- [enerContainer-1] c.b.services.BulkLoaderServices : Problem while bulkLoading XXX.201211.df5e480c604896098447873e1436a75e
org.springframework.jms.IllegalStateException: The Session is closed; nested exception is javax.jms.IllegalStateException: The Session is closed
at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:279)
at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:169)
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:496)
at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:579)
at com.bulkLoader.services.BulkLoaderServices.dataLoaded(BulkLoaderServices.java:155)
at com.bulkLoader.services.BulkLoaderServices.bulkLoad(BulkLoaderServices.java:116)
at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:185)
at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:104)
at org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:90)
at org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter.onMessage(MessagingMessageListenerAdapter.java:66)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:674)
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:634)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:605)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:308)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:226)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1144)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1136)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1033)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.jms.IllegalStateException: The Session is closed
at org.apache.activemq.ActiveMQSession.checkClosed(ActiveMQSession.java:767)
at org.apache.activemq.ActiveMQSession.createQueue(ActiveMQSession.java:1265)
at org.springframework.jms.support.destination.DynamicDestinationResolver.resolveQueue(DynamicDestinationResolver.java:84)
at org.springframework.jms.support.destination.DynamicDestinationResolver.resolveDestinationName(DynamicDestinationResolver.java:58)
at org.springframework.jms.support.destination.JmsDestinationAccessor.resolveDestinationName(JmsDestinationAccessor.java:98)
at org.springframework.jms.core.JmsTemplate.access$200(JmsTemplate.java:90)
at org.springframework.jms.core.JmsTemplate$4.doInJms(JmsTemplate.java:582)
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:493)
... 19 common frames omitted
2015-05-18 17:48:19.326 ERROR 27713 --- [enerContainer-1] o.s.j.l.DefaultMessageListenerContainer : Application exception overridden by rollback exception
org.springframework.jms.listener.adapter.ListenerExecutionFailedException: Listener method 'public void com.bulkLoader.services.BulkLoaderServices.bulkLoad(java.io.File)' threw exception; nested exception is org.springframework.jms.IllegalStateException: The Session is closed; nested exception is javax.jms.IllegalStateException: The Session is closed
at org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:98)
at org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter.onMessage(MessagingMessageListenerAdapter.java:66)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:674)
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:634)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:605)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:308)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:226)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1144)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1136)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1033)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.jms.IllegalStateException: The Session is closed; nested exception is javax.jms.IllegalStateException: The Session is closed
at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:279)
at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:169)
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:496)
at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:579)
at com.bulkLoader.services.BulkLoaderServices.submitErrorProblem(BulkLoaderServices.java:164)
at com.bulkLoader.services.BulkLoaderServices.bulkLoad(BulkLoaderServices.java:125)
at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:185)
at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:104)
at org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:90)
... 10 common frames omitted
Caused by: javax.jms.IllegalStateException: The Session is closed
at org.apache.activemq.ActiveMQSession.checkClosed(ActiveMQSession.java:767)
at org.apache.activemq.ActiveMQSession.createQueue(ActiveMQSession.java:1265)
at org.springframework.jms.support.destination.DynamicDestinationResolver.resolveQueue(DynamicDestinationResolver.java:84)
at org.springframework.jms.support.destination.DynamicDestinationResolver.resolveDestinationName(DynamicDestinationResolver.java:58)
at org.springframework.jms.support.destination.JmsDestinationAccessor.resolveDestinationName(JmsDestinationAccessor.java:98)
at org.springframework.jms.core.JmsTemplate.access$200(JmsTemplate.java:90)
at org.springframework.jms.core.JmsTemplate$4.doInJms(JmsTemplate.java:582)
at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:493)
... 19 common frames omitted
2015-05-18 17:48:19.327 WARN 27713 --- [enerContainer-1] o.s.j.l.DefaultMessageListenerContainer : Execution of JMS message listener failed, and no ErrorHandler has been set.
javax.jms.IllegalStateException: The Session is closed
at org.apache.activemq.ActiveMQSession.checkClosed(ActiveMQSession.java:767)
at org.apache.activemq.ActiveMQSession.getTransacted(ActiveMQSession.java:532)
at org.springframework.jms.listener.AbstractMessageListenerContainer.rollbackOnExceptionIfNecessary(AbstractMessageListenerContainer.java:747)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:612)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:308)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:226)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1144)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1136)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1033)
at java.lang.Thread.run(Thread.java:745)

Spring Integration DSL ErrorHandling

As the title says, I'm looking for a good example on errorHandling within a DSL flow. Specifically, I'm looking to handle errors from a service activator.
Example:
IntegrationFlows.from(Amqp.inboundAdapter(simpleMessageListenerContainer()))
.transform(new JsonToObjectTransformer(AlbumDescriptor.class))
.handle(AlbumDescriptor.class, (p,h) -> transformXml(p))
.transform(new ObjectToJsonTransformer())
.handle(Amqp.outboundAdapter(rabbitTemplate).routingKey("xml-transformed"))
.get();
If my function transformXml(p) throws an exception, how do I make it go to a specific errorChannel.
If an exception is not thrown, everything works just as I want it to.
Currently, if an exceptions is thrown from this function I get the following exception:
2014-09-17 15:26:28.566 WARN 16339 --- [cTaskExecutor-1] s.a.r.l.ConditionalRejectingErrorHandler : Execution of Rabbit message listener failed.
org.springframework.amqp.rabbit.listener.ListenerExecutionFailedException: Listener threw exception
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.wrapToListenerExecutionFailedExceptionIfNeeded(AbstractMessageListenerContainer.java:758)
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:653)
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:576)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$001(SimpleMessageListenerContainer.java:78)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$1.invokeListener(SimpleMessageListenerContainer.java:161)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.invokeListener(SimpleMessageListenerContainer.java:1177)
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:559)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:950)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:934)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$600(SimpleMessageListenerContainer.java:78)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1045)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.messaging.MessageHandlingException: java.lang.reflect.InvocationTargetException
at org.springframework.integration.dsl.LambdaMessageProcessor.processMessage(LambdaMessageProcessor.java:125)
at org.springframework.integration.handler.ServiceActivatingHandler.handleRequestMessage(ServiceActivatingHandler.java:71)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:170)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78)
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:101)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:97)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:255)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:223)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:109)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:44)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:94)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendMessage(AbstractReplyProducingMessageHandler.java:260)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendReplyMessage(AbstractReplyProducingMessageHandler.java:241)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.produceReply(AbstractReplyProducingMessageHandler.java:205)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleResult(AbstractReplyProducingMessageHandler.java:199)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:177)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78)
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:101)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:97)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:255)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:223)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:109)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:44)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:94)
at org.springframework.integration.endpoint.MessageProducerSupport.sendMessage(MessageProducerSupport.java:98)
at org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter.access$400(AmqpInboundChannelAdapter.java:44)
at org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter$1.onMessage(AmqpInboundChannelAdapter.java:90)
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:650)
... 10 common frames omitted
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.integration.dsl.LambdaMessageProcessor.processMessage(LambdaMessageProcessor.java:122)
... 41 common frames omitted
Caused by: com.amazonaws.services.s3.model.AmazonS3Exception: The specified key does not exist. (Service: Amazon S3; Status Code: 404; Error Code: NoSuchKey; Request ID: 7029FF03D01CFB95)
at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:1053)
at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:662)
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:428)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:290)
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3655)
at com.amazonaws.services.s3.AmazonS3Client.getObject(AmazonS3Client.java:1132)
at com.amazonaws.services.s3.AmazonS3Client.getObject(AmazonS3Client.java:1004)
at com.emusic.indiegestion.integration.flows.AlbumTransformFlowConfig.transformXml(AlbumTransformFlowConfig.java:67)
at com.emusic.indiegestion.integration.flows.AlbumTransformFlowConfig.lambda$0(AlbumTransformFlowConfig.java:49)
at com.emusic.indiegestion.integration.flows.AlbumTransformFlowConfig$$Lambda$1/2142893855.handle(Unknown Source)
... 46 common frames omitted
Actually there is no difference if it is DSL or raw XML Spring Integration config.
Amqp.inboundAdapter() provides .errorChannel() option as well as <amqp:inbound-channel-adapter> provides error-channel attribute.
As I say in the manual DSL does the same as all other Spring Integration configuration variants. So, Error Handling here is the same too.
More info on the matter: http://docs.spring.io/spring-integration/docs/latest-ga/reference/html/configuration.html#namespace-errorhandler

Resources