Package org.springframework.jms.core

Examples of org.springframework.jms.core.MessageCreator


   */
  public void sendMessage(final String messageTxt) throws RpException{
   
   
    try {
    jmsTemplate.send(new MessageCreator() {
     
      public Message createMessage(Session session) throws JMSException {

        log.debug("Creating the message:"+messageTxt);

View Full Code Here


        try {
            Destination replyTo = message.getJMSReplyTo();
            if (replyTo != null) {
                log.info("About to send reply to: " + replyTo);
                //jmsTemplate.convertAndSend(replyTo, "This is the reply from message: " + message);
                jmsTemplate.send(replyTo, new MessageCreator() {
                    public Message createMessage(Session session) throws JMSException {
                        return session.createTextMessage("This is the reply from message: " + message);
                    }
                });
            }
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 ValueHolder<FutureTask> futureHolder = new ValueHolder<FutureTask>();
        final DeferredMessageSentCallback callback = msgIdAsCorrId ? deferredRequestReplyMap.createDeferredMessageSentCallback() : null;

        MessageCreator messageCreator = new MessageCreator() {
            public Message createMessage(Session session) throws JMSException {
                Message message = endpoint.getBinding().makeJmsMessage(exchange, in, session, null);
                message.setJMSReplyTo(replyTo);
                requestor.setReplyToSelectorHeader(in, message);
View Full Code Here

                        + " Exchange: " + exchange);
                exchange.getIn().setHeader("JMSReplyTo", null);
            }
        }

        MessageCreator messageCreator = new MessageCreator() {
            public Message createMessage(Session session) throws JMSException {
                return endpoint.getBinding().makeJmsMessage(exchange, in, session, null);
            }
        };
View Full Code Here

                // there should be a JMSReplyTo so we know where to send the reply
                final Destination replyTo = msg.getJMSReplyTo();

                // send reply
                jms.send(replyTo, new MessageCreator() {
                    public Message createMessage(Session session) throws JMSException {
                        TextMessage replyMsg = session.createTextMessage();
                        replyMsg.setText("My name is Arnio");
                        replyMsg.setJMSCorrelationID(msg.getJMSCorrelationID());
                        return replyMsg;
                    }
                });

                return null;
            }
        });


        // now get started and send the first message that gets the ball rolling
        JmsTemplate jms = new JmsTemplate(amq.getConfiguration().getConnectionFactory());

        jms.send("hello", new MessageCreator() {
            public Message createMessage(Session session) throws JMSException {
                TextMessage msg = session.createTextMessage();
                msg.setText("Hello, I'm here");
                return msg;
            }
View Full Code Here

            if (LOG.isDebugEnabled()) {
                LOG.debug("Cannot send reply message as there is no replyDestination for: " + out);
            }
            return;
        }
        getTemplate().send(replyDestination, new MessageCreator() {
            public Message createMessage(Session session) throws JMSException {
                Message reply = endpoint.getBinding().makeJmsMessage(exchange, out, session, cause);
                final String correlationID = determineCorrelationId(message);
                reply.setJMSCorrelationID(correlationID);
View Full Code Here

            if (LOG.isDebugEnabled()) {
                LOG.debug("Cannot send reply message as there is no replyDestination for: " + out);
            }
            return;
        }
        getTemplate().send(replyDestination, new MessageCreator() {
            public Message createMessage(Session session) throws JMSException {
                Message reply = endpoint.getBinding().makeJmsMessage(exchange, out, session, cause);

                if (endpoint.getConfiguration().isUseMessageIDAsCorrelationID()) {
                    String messageID = exchange.getIn().getHeader("JMSMessageID", String.class);
View Full Code Here

    }

    @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

        final String originalCorrelationId = in.getHeader("JMSCorrelationID", String.class);
        if (originalCorrelationId == null && !msgIdAsCorrId) {
            in.setHeader("JMSCorrelationID", getUuidGenerator().generateUuid());
        }

        MessageCreator messageCreator = new MessageCreator() {
            public Message createMessage(Session session) throws JMSException {
                Message message = 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

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.