Examples of MessageCreator


Examples of org.springframework.jms.core.MessageCreator

    }

    @Test
    public void testManualRequestReply() throws Exception {
        // send using pure JMS API to set a custom JMSReplyTo
        jms.send(new ActiveMQQueue("foo"), new MessageCreator() {
            public Message createMessage(Session session) throws JMSException {
                TextMessage msg = session.createTextMessage("Hello World");
                msg.setJMSReplyTo(new ActiveMQQueue("bar"));
                return msg;
            }
View Full Code Here

Examples of org.springframework.jms.core.MessageCreator

    @Test
    public void testConsumeObjectMessage() throws Exception {
        endpoint.expectedMessageCount(1);

        jmsTemplate.setPubSubDomain(false);
        jmsTemplate.send("test.object", new MessageCreator() {
            public Message createMessage(Session session) throws JMSException {
                ObjectMessage msg = session.createObjectMessage();

                MyUser user = new MyUser();
                user.setName("Claus");
View Full Code Here

Examples of org.springframework.jms.core.MessageCreator

    @Test
    public void testConsumeMapMessage() throws Exception {
        endpoint.expectedMessageCount(1);

        jmsTemplate.setPubSubDomain(false);
        jmsTemplate.send("test.map", new MessageCreator() {
            public Message createMessage(Session session) throws JMSException {
                MapMessage mapMessage = session.createMapMessage();
                mapMessage.setString("foo", "abc");
                mapMessage.setString("bar", "xyz");
                return mapMessage;
View Full Code Here

Examples of org.springframework.jms.core.MessageCreator

        if (generateFreshCorrId) {
            // we append the 'Camel-' prefix to know it was generated by us
            in.setHeader("JMSCorrelationID", GENERATED_CORRELATION_ID_PREFIX + getUuidGenerator().generateUuid());
        }
       
        MessageCreator messageCreator = new MessageCreator() {
            public Message createMessage(Session session) throws JMSException {
                Message answer = endpoint.getBinding().makeJmsMessage(exchange, in, session, null);

                // get the reply to destination to be used from the reply manager
                Destination replyTo = replyManager.getReplyTo();
View Full Code Here

Examples of org.springframework.jms.core.MessageCreator

            // prefer to use destination over destination name
            destinationName = null;
        }
        final String to = destinationName != null ? destinationName : "" + destination;

        MessageCreator messageCreator = new MessageCreator() {
            public Message createMessage(Session session) throws JMSException {
                Message answer = endpoint.getBinding().makeJmsMessage(exchange, in, session, null);

                // when in InOnly mode the JMSReplyTo is a bit complicated
                // we only want to set the JMSReplyTo on the answer if
View Full Code Here

Examples of org.springframework.jms.core.MessageCreator

  @Autowired
  @Qualifier(value = "jmsProducerTemplate")
  private JmsTemplate template;

  public void send(final String text) {
    template.send(new MessageCreator() {
      public Message createMessage(Session session) throws JMSException {
        TextMessage msg = session.createTextMessage(text);
        return msg;
      }
    });
View Full Code Here

Examples of org.springframework.jms.core.MessageCreator

  @Autowired
  @Qualifier("ingestJmsProducerTemplate")
  private JmsTemplate template;
 
  public void send(final Map<String, String> messageBody) {
    template.send(new MessageCreator() {
      public Message createMessage(Session session) throws JMSException {
        JSONObject json = new JSONObject();
        for (String key : messageBody.keySet()) {
          json.put(key, messageBody.get(key));
        }
View Full Code Here

Examples of org.springframework.jms.core.MessageCreator

  @Autowired
  @Qualifier(value = "preingestJmsProducerTemplate")
  private JmsTemplate template;

  public void send(final Map<String, String> messageBody) {
    template.send(new MessageCreator() {
      public Message createMessage(Session session) throws JMSException {
        JSONObject json = new JSONObject();
        for (String key : messageBody.keySet()) {
          json.put(key, messageBody.get(key));
        }
View Full Code Here

Examples of org.springframework.jms.core.MessageCreator

                            @Override
                            protected void doInTransactionWithoutResult(TransactionStatus status) {
                                try {

                                    for (final String queue : QUEUES) {
                                        jmsTemplate.send(queue + "," + AUDIT, new MessageCreator() {
                                            public Message createMessage(Session session) throws JMSException {
                                                return session.createTextMessage("P1: " + queue + " - " + BODY);
                                            }
                                        });
                                        Thread.sleep((long) (Math.random() * SLEEP));
 
View Full Code Here

Examples of org.springframework.jms.core.MessageCreator

                            @Override
                            protected void doInTransactionWithoutResult(TransactionStatus status) {
                                try {

                                    for (final String queue : QUEUES) {
                                        jmsTemplate.send(queue + "," + AUDIT, new MessageCreator() {
                                            public Message createMessage(Session session) throws JMSException {
                                                return session.createTextMessage("P1: " + queue + " - " + BODY);
                                            }
                                        });
                                        Thread.sleep((long) (Math.random() * SLEEP));
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.