Package org.springframework.jms.core

Examples of org.springframework.jms.core.MessageCreator


   
    public void receiveAndRespondWithMessageIdAsCorrelationId() throws JmsException, JMSException {
        JmsTemplate template = new JmsTemplate(connectionFactory);       
        final javax.jms.Message message = template.receive("queue:test");
        requestMessageId = message.getJMSMessageID();
        template.send(message.getJMSReplyTo(), new MessageCreator() {

            public javax.jms.Message createMessage(Session session) throws JMSException {
                TextMessage replyMessage =  session.createTextMessage("Result");
                replyMessage.setJMSCorrelationID(message.getJMSMessageID());
                return replyMessage;
View Full Code Here


                                                             false);
                    }
                });
               
                final Message message = jmsTemplate.receive(destination);
                MessageCreator messageCreator = new MessageCreator() {
                    public Message createMessage(Session session) {
                        return message;
                    }
                };
                   
View Full Code Here

  
  Destination destination;
 
  public void send(){
    MessageCreator messageCreator = new MessageCreator(){
        public Message createMessage(Session session){
          TextMessage message = null;
          try {
            message = session.createTextMessage("��� Hello");
          } catch (JMSException e) {
View Full Code Here

    // Implementation methods
    //-------------------------------------------------------------------------
    protected void process(MessageExchange exchange, final NormalizedMessage inMessage) throws MessagingException {
        try {
            template.send(new MessageCreator() {
                public Message createMessage(Session session) throws JMSException {
                    try {
                        Message message = marshaler.createMessage(inMessage, session);
                        if (log.isTraceEnabled()) {
                            log.trace("Sending message to: " + template.getDefaultDestinationName() + " message: " + message);
View Full Code Here

            e.printStackTrace();
        }
    }

    public void sendMessage(final TextMessage requestMsg, final String serviceAvailable) throws JMSException {
        template.send(requestMsg.getJMSReplyTo(), new MessageCreator() {
            public Message createMessage(Session session) throws JMSException {
                TextMessage message = session.createTextMessage();
                // set the correlation ID
                message.setJMSCorrelationID(requestMsg.getJMSMessageID());
                // set the text
View Full Code Here

                marshaler.toNMS(inMessage, jmsMessage);
                messageExchange.setInMessage(inMessage);
                if (getDeliveryChannel().sendSync(messageExchange)) {
                    Destination destination = getReplyToDestination(jmsMessage, messageExchange);
                    try {
                        template.send(destination, new MessageCreator() {
                            public Message createMessage(Session session) throws JMSException {
                                try {
                                    Message message = marshaler.createMessage(messageExchange.getOutMessage(), session);
                                    message.setJMSCorrelationID(jmsMessage.getJMSCorrelationID());
                                    if (log.isTraceEnabled()) {
View Full Code Here

                        final JmsTemplate template = new JmsTemplate(
                                cachingConnectionFactory);
                        final ActiveMQQueue queue = new ActiveMQQueue(
                                "testingqueue");
                        for (int i = 0; i < total; i++) {
                            template.send(queue, new MessageCreator() {

                                public Message createMessage(
                                        final Session session)
                                        throws JMSException {
                                    final TextMessage message = session
View Full Code Here

                        singleConnectionFactory2);
                final JmsTemplate template = new JmsTemplate(
                        cachingConnectionFactory);
                final ActiveMQQueue queue = new ActiveMQQueue(TESTING_QUEUE);
                for (int i = 0; i < total; i++) {
                    template.send(queue, new MessageCreator() {

                        public Message createMessage(final Session session)
                                throws JMSException {
                            final TextMessage message = session
                                    .createTextMessage();
View Full Code Here

                  connector.destroy();
                }
            }
            // broadcast change to the network
            log.info("broadcast to internal JMS network: " + event);
            jmsTemplate.send(broadcastTopic, new MessageCreator() {
        public Message createMessage(Session session) throws JMSException {
          return session.createObjectMessage(event);
        }
            });
        }
View Full Code Here

                if (me.getRole() == Role.PROVIDER){
                    destination = INBOUND_PREFIX + componentName;
                }else {
                    destination = INBOUND_PREFIX + id.getContainerName();
                }
                jt.send(destination, new MessageCreator() {
          public Message createMessage(Session session) throws JMSException {
                      return session.createObjectMessage(me);
          }
        });
            } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.springframework.jms.core.MessageCreator

Copyright © 2018 www.massapicom. 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.