Guest User

Untitled

a guest
Nov 6th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.40 KB | None | 0 0
  1. <beans xmlns="http://www.springframework.org/schema/beans"
  2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xmlns:int="http://www.springframework.org/schema/integration"
  4. xmlns:int-amqp="http://www.springframework.org/schema/integration/amqp"
  5. xmlns:rabbit="http://www.springframework.org/schema/rabbit"
  6. xmlns:task="http://www.springframework.org/schema/task"
  7. xmlns:context="http://www.springframework.org/schema/context"
  8. xsi:schemaLocation="
  9. http://www.springframework.org/schema/beans
  10. http://www.springframework.org/schema/beans/spring-beans.xsd
  11. http://www.springframework.org/schema/integration
  12. http://www.springframework.org/schema/integration/spring-integration.xsd
  13. http://www.springframework.org/schema/integration/amqp
  14. http://www.springframework.org/schema/integration/amqp/spring-integration-amqp.xsd
  15. http://www.springframework.org/schema/rabbit
  16. http://www.springframework.org/schema/rabbit/spring-rabbit.xsd
  17. http://www.springframework.org/schema/task
  18. http://www.springframework.org/schema/task/spring-task.xsd
  19. http://www.springframework.org/schema/context
  20. http://www.springframework.org/schema/context/spring-context.xsd">
  21.  
  22. <context:property-placeholder location="classpath:spring/prj-rabbitmq-context-thirdparty.properties" ignore-unresolvable="true" order="3"/>
  23.  
  24. <rabbit:connection-factory
  25. id="prjRabbitmqConnectionFactory"
  26. addresses="${rabbitmq.addresses}"
  27. username="${rabbitmq.username}"
  28. password="${rabbitmq.password}"
  29. connection-timeout="5000" />
  30.  
  31. <bean id="rabbitTxManager"
  32. class="org.springframework.amqp.rabbit.transaction.RabbitTransactionManager">
  33. <property name="connectionFactory" ref="prjRabbitmqConnectionFactory"/>
  34. </bean>
  35.  
  36. <rabbit:template
  37. id="prjRabbitmqTemplate"
  38. connection-factory="prjRabbitmqConnectionFactory"
  39. message-converter="serializerMessageConverter"
  40. retry-template="retryTemplate" />
  41.  
  42. <bean id="retryTemplate" class="org.springframework.retry.support.RetryTemplate">
  43. <property name="backOffPolicy">
  44. <bean class="org.springframework.retry.backoff.ExponentialBackOffPolicy">
  45. <property name="initialInterval" value="1000" />
  46. <property name="multiplier" value="3" />
  47. <property name="maxInterval" value="10000" />
  48. </bean>
  49. </property>
  50. </bean>
  51.  
  52. <rabbit:admin
  53. id="prjRabbitmqAdmin"
  54. auto-startup="true"
  55. connection-factory="prjRabbitmqConnectionFactory" />
  56.  
  57. <rabbit:queue
  58. id="prjSyncQueue"
  59. name="${prj.sync.queue}"
  60. durable="true">
  61. <rabbit:queue-arguments>
  62. <entry key="x-ha-policy" value="all" />
  63. </rabbit:queue-arguments>
  64. </rabbit:queue>
  65.  
  66.  
  67. <rabbit:listener-container
  68. connection-factory="prjRabbitmqConnectionFactory"
  69. acknowledge="auto"
  70. channel-transacted="true"
  71. transaction-manager="rabbitTxManager"
  72. task-executor="prjSyncExecutor"
  73. concurrency="1"
  74. max-concurrency="2"
  75. requeue-rejected="true"
  76. message-converter="serializerMessageConverter">
  77. <rabbit:listener
  78. ref="prjProcessorService"
  79. queue-names="${prj.sync.queue}" method="processMessage" />
  80. </rabbit:listener-container>
  81.  
  82. <task:executor id="prjSyncExecutor"
  83. pool-size="${prj.sync.concurrency.min}-${prj.sync.concurrency.max}"
  84. keep-alive="${prj.sync.concurrency.keep-alive}"
  85. queue-capacity="${prj.sync.concurrency.queue}"
  86. rejection-policy="CALLER_RUNS"/>
  87. <int:channel
  88. id="prjChannel" />
  89.  
  90. <int-amqp:outbound-channel-adapter
  91. channel="prjChannel"
  92. amqp-template="prjRabbitmqTemplate"
  93. exchange-name="prjSyncExchange"
  94. routing-key="prj-event"
  95. default-delivery-mode="PERSISTENT" />
  96.  
  97.  
  98. <rabbit:direct-exchange
  99. name="prjSyncExchange">
  100. <rabbit:bindings>
  101. <rabbit:binding
  102. queue="prjSyncQueue"
  103. key="prj-event" />
  104. </rabbit:bindings>
  105. </rabbit:direct-exchange>
  106.  
  107. <int:gateway
  108. id="prjGateway"
  109. service-interface="ro.oss.niinoo.thirdparty.prj.gateway.prjEnrichmentGateway">
  110. <int:method
  111. name="send"
  112. request-channel="prjChannel"/>
  113. </int:gateway>
  114.  
  115. <bean id="prjProcessorService" class="ro.oss.niinoo.thirdparty.prj.processor.impl.prjEnrichmentProcessorImpl" />
  116. <bean id="serializerMessageConverter" class="ro.oss.niinoo.thirdparty.prj.serializer.prjSerializer"/>
Add Comment
Please, Sign In to add comment