Advertisement
Guest User

Untitled

a guest
Sep 17th, 2014
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. <!-- AMQP messaging configurations starts here -->
  2. <!-- Spring AMQP connection factory -->
  3. <rabbit:connection-factory id="connectionFactory"
  4. host="localhost"
  5. port="5672"
  6. username="guest"
  7. password="guest"
  8. channel-cache-size="25"/>
  9.  
  10. <!-- Queues -->
  11. <rabbit:queue name="test.queue"/>
  12.  
  13. <!-- Exchanges with their queue bindings -->
  14. <rabbit:topic-exchange name="test.exchange">
  15. <rabbit:bindings>
  16. <rabbit:binding queue="test.queue" pattern="test.*"/>
  17. </rabbit:bindings>
  18. </rabbit:topic-exchange>
  19.  
  20. <!-- Spring AMQP template - Creates a bean which can send a message to the topicExchange-->
  21. <rabbit:template id="testTemplate"
  22. connection-factory="connectionFactory"
  23. exchange="test.exchange"/>
  24.  
  25. <!-- Spring AMQP Admin -->
  26. <rabbit:admin connection-factory="connectionFactory"/>
  27.  
  28. @Service
  29. public class AsyncQueueServiceImplementation implements AsyncQueueService
  30. {
  31.  
  32. @Autowired
  33. private AmqpTemplate template;
  34.  
  35. @Override
  36. @Async
  37. public void publish()
  38. {
  39. template.convertAndSend("test.debug", "test payload");
  40. }
  41. }
  42.  
  43. @RunWith(SpringJUnit4ClassRunner.class)
  44. @ContextConfiguration(locations = { "classpath:application-context-unitTests.xml" })
  45. public class AsyncTraceServiceImplementationTest
  46. {
  47.  
  48. @Autowired
  49. AsyncTraceService traceService;
  50.  
  51. @Test
  52. public void testPublishAtDebugLevel()
  53. {
  54. traceService.publish();
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement