Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:int="http://www.springframework.org/schema/integration"
- xmlns:int-amqp="http://www.springframework.org/schema/integration/amqp"
- xmlns:rabbit="http://www.springframework.org/schema/rabbit"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/integration
- http://www.springframework.org/schema/integration/spring-integration.xsd
- http://www.springframework.org/schema/integration/amqp
- http://www.springframework.org/schema/integration/amqp/spring-integration-amqp.xsd
- http://www.springframework.org/schema/rabbit
- http://www.springframework.org/schema/rabbit/spring-rabbit.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context.xsd">
- <rabbit:connection-factory id="connectionFactory" host="bigdata-rdp" username="myuser" password="mypass" />
- <rabbit:template id="amqpTemplate" connection-factory="connectionFactory" />
- <rabbit:admin connection-factory="connectionFactory" />
- <rabbit:queue name="first" auto-delete="false" durable="true" />
- <rabbit:queue name="second" auto-delete="false" durable="true" />
- <rabbit:queue name="errorQueue" auto-delete="false" durable="true" />
- <rabbit:fanout-exchange name="second-exchange" auto-delete="true" durable="true">
- <rabbit:bindings>
- <rabbit:binding queue="second" />
- </rabbit:bindings>
- </rabbit:fanout-exchange>
- <rabbit:fanout-exchange name="error-exchange" auto-delete="true" durable="true">
- <rabbit:bindings>
- <rabbit:binding queue="errorQueue" />
- </rabbit:bindings>
- </rabbit:fanout-exchange>
- <int-amqp:outbound-channel-adapter channel="messageOutputChannel" exchange-name="second-exchange" amqp-template="amqpTemplate" />
- <int-amqp:inbound-channel-adapter channel="messageInputChannel" error-channel = "errorInputChannel" queue-names="first" connection-factory="connectionFactory" concurrent-consumers="20" />
- <int-amqp:outbound-channel-adapter channel="errorOutputChannel" exchange-name="error-exchange" amqp-template="amqpTemplate" />
- <bean id="MessageErrorHandler" class = "firstAttempt.MessageErrorHandler"/>
- <int:channel id="messageInputChannel" />
- <int:channel id="messageOutputChannel"/>
- <int:channel id="errorOutputChannel"/>
- <int:channel id="errorInputChannel"/>
- <int:chain input-channel="errorInputChannel" output-channel="errorOutputChannel">
- <int:header-enricher >
- <int:header name="error" expression = "getPayload()"/>
- </int:header-enricher>
- <int:service-activator method = "handleError" >
- <bean class="firstAttempt.MessageErrorHandler"/>
- </int:service-activator>
- </int:chain>
- <int:chain input-channel="messageInputChannel" output-channel="messageOutputChannel">
- <int:transformer method = "convert" >
- <bean class="firstAttempt.JsonObjectConverter" />
- </int:transformer>
- <int:service-activator method="transform">
- <bean class="firstAttempt.Transformer" />
- </int:service-activator>
- <int:object-to-string-transformer />
- </int:chain>
- </beans>
- public class MessageErrorHandler {
- public String handleError(MessageHandlingException m) {
- return m.getMessage();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement