Package javax.jbi.messaging

Examples of javax.jbi.messaging.MessageExchange.createMessage()


    private static Log log = LogFactory.getLog(SerializedMarshaler.class);

    public MessageExchange createExchange(HttpServletRequest request, ComponentContext context) throws Exception {
        MessageExchange me = context.getDeliveryChannel().createExchangeFactory().createExchange(getDefaultMep());
        NormalizedMessage in = me.createMessage();
        in.setContent(marshal(request.getInputStream()));
        me.setMessage(in, "in");
        return me;
    }
View Full Code Here


        update();
    }

    public void answer(String content) throws Exception {
        MessageExchange me = this.exchange.getInternalExchange();
        NormalizedMessage out = me.createMessage();
        out.setContent(new StringSource(content));
        me.setMessage(out, "out");
        getChannel().sendSync(me);
        update();
    }
View Full Code Here

                MessageExchange me = factory.createExchange(mep);
                me.setInterfaceName((QName) context.getService().getProperty(JBI_INTERFACE_NAME));
                me.setOperation(context.getExchange().getOperation().getQName());
                me.setService((QName) context.getService().getProperty(JBI_SERVICE_NAME));
                me.setEndpoint((ServiceEndpoint) context.getService().getProperty(JBI_ENDPOINT));
                NormalizedMessage msg = me.createMessage();
                me.setMessage(msg, "in");
                if (Boolean.TRUE.equals(context.getService().getProperty(JBI_SECURITY_PROPAGATATION))) {
                    MessageExchange oldMe = JBIContext.getMessageExchange();
                    NormalizedMessage oldMsg = (oldMe != null) ? oldMe.getMessage("in") : null;
                    if (oldMsg != null) {
View Full Code Here

    }

    public MessageExchange createExchange(JmsContext jmsContext, ComponentContext jbiContext) throws Exception {
        Context ctx = (Context) jmsContext;
        MessageExchange exchange = jbiContext.getDeliveryChannel().createExchangeFactory().createExchange(mep);
        NormalizedMessage inMessage = exchange.createMessage();
        populateMessage(ctx.message, inMessage);
        exchange.setMessage(inMessage, "in");
        return exchange;
    }
View Full Code Here

            ServiceEndpoint se = componentContext.getEndpoint(serviceName, endpointName);
            if (se != null) {
                exchange.setEndpoint(se);
            }
        }
        NormalizedMessage inMessage = exchange.createMessage();
        jbiMarshaler.toNMS(inMessage, context.getInMessage());
        exchange.setMessage(inMessage, "in");
        return exchange;
    }
View Full Code Here

public class MessageExchangeImplTest extends TestCase {
   
    protected void testSerializeDeserialize(Source src) throws Exception {
        MessageExchange me = new InOnlyImpl("exchangeId");
        me.setProperty("myProp", "myValue");
        NormalizedMessage msg = me.createMessage();
        msg.setProperty("myMsgProp", "myMsgValue");
        msg.setContent(src);
        //msg.addAttachment("myAttachment", null);
        me.setMessage(msg, "in");
       
View Full Code Here

        Message message = new MessageImpl();
        message.setExchange(exchange);
       
       
        MessageExchange messageExchange = control.createMock(MessageExchange.class);
        EasyMock.expect(messageExchange.createMessage()).andReturn(normalizedMessage);
        message.put(MessageExchange.class, messageExchange);
        channel.send(messageExchange);
        EasyMock.replay(channel);
       
        JBIDestinationOutputStream jbiOS = new JBIDestinationOutputStream(message, channel);
View Full Code Here

                xchng = factory.createRobustInOnlyExchange();
            } else {
                xchng = factory.createInOutExchange();
            }

            NormalizedMessage inMsg = xchng.createMessage();
            LOG.info(new org.apache.cxf.common.i18n.Message("EXCHANGE.ENDPOINT", LOG).toString()
                     + xchng.getEndpoint());
            if (inMsg != null) {
                LOG.info("setup message contents on " + inMsg);
                inMsg.setContent(getMessageContent(message));
View Full Code Here

                xchng = factory.createRobustInOnlyExchange();
            } else {
                xchng = factory.createInOutExchange();
            }

            NormalizedMessage inMsg = xchng.createMessage();
            LOG.info(new org.apache.cxf.common.i18n.Message("EXCHANGE.ENDPOINT", LOG).toString()
                     + xchng.getEndpoint());
            if (inMsg != null) {
                LOG.info("setup message contents on " + inMsg);
                inMsg.setContent(getMessageContent(message));
View Full Code Here

                        }
                    } else {
                        xchng.setError(f);
                    }
                } else {
                    NormalizedMessage msg = xchng.createMessage();
                    //copy attachments
                    if (outMessage != null && outMessage.getAttachments() != null) {
                        for (Attachment att : outMessage.getAttachments()) {
                            msg.addAttachment(att.getId(), att
                                    .getDataHandler());
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.