Package javax.jbi.messaging

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


                return true;
            }
        }

        InOut inOut = getExchangeFactory().createInOutExchange();
        NormalizedMessage request = inOut.createMessage();
        getMessageTransformer().transform(exchange, in, request);
        inOut.setInMessage(request);
        getDeliveryChannel().sendSync(inOut);

        NormalizedMessage response = inOut.getOutMessage();
View Full Code Here


    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        logger.trace("Invoked: {}", proxy);
        try {
            InOut messageExchange = getDeliveryChannel().createExchangeFactory().createInOutExchange();
            NormalizedMessage inMessage = messageExchange.createMessage();
            inMessage.setProperty("proxy", proxy);
            inMessage.setProperty("method", method);
            inMessage.setProperty("args", args);       

            messageExchange.setInMessage(inMessage);
View Full Code Here

    }

    public XMLStreamReader invokeRequest(ASInvocation invocation, String xml) throws Exception {
        MessageExchangeFactory fac = channel.createExchangeFactory();
        InOut exchange = fac.createInOutExchange();
        NormalizedMessage inMessage = exchange.createMessage();
        marshaler.setContent(inMessage, xml);
        exchange.setInMessage(inMessage);
        boolean answer = channel.sendSync(exchange);
        if (answer) {
            NormalizedMessage outMessage = exchange.getOutMessage();
View Full Code Here

        activationSpec.setService(service);
        receiverContainer.activateComponent(activationSpec);
        DefaultServiceMixClient client = new DefaultServiceMixClient(senderContainer);
        for (int i = 0; i < 10; i++) {
            InOut inOut = client.createInOutExchange(service, null, null);
            NormalizedMessage inMessage = inOut.createMessage();
            inMessage.setContent(new StringSource("<test id='" + i + "'/>"));
            inOut.setInMessage(inMessage);
            client.send(inOut);
            inOut = (InOut) client.receive(1000);
            assertNotNull(inOut.getOutMessage());
View Full Code Here

        public void onMessageExchange(MessageExchange exchange) throws MessagingException {
            if (exchange.getStatus() == ExchangeStatus.ACTIVE && exchange instanceof InOut) {
                InOut inOut = (InOut) exchange;
                NormalizedMessage inMessage = inOut.getInMessage();
                NormalizedMessage outMessage = inOut.createMessage();
                outMessage.setContent(inMessage.getContent());
                inOut.setOutMessage(outMessage);
                send(inOut);
            }
        }
View Full Code Here

            public void run() {

                try {
                    InOut me = (InOut) channel.accept(10000);
                    NormalizedMessage nm = me.createMessage();
                    nm.setContent(new StringSource("<response>" + counter
                            + "</response>"));
                    me.setOutMessage(nm);
                    channel.sendSync(me);
View Full Code Here

                InOut me = mef.createInOutExchange();
                me.setService(new QName("echo"));
                if (stateless) {
                    me.setProperty(JbiConstants.STATELESS_CONSUMER, Boolean.TRUE);
                }
                me.setInMessage(me.createMessage());
                me.getInMessage().setContent(new StringSource("<hello/>"));
                getDeliveryChannel().send(me);

            }
        }
View Full Code Here

        QName service = getQNameAttribute(namespaceContext, element, "service");
        QName interfaceName = getQNameAttribute(namespaceContext, element, "interface");
        QName operation = getQNameAttribute(namespaceContext, element, "operation");

        InOut outExchange = component.createInOutExchange(service, interfaceName, operation);
        NormalizedMessage out = outExchange.createMessage();
        outExchange.setInMessage(out);


        // lets copy the content into the body
        Document document = getTransformer().createDocument();
View Full Code Here

        // Create another thread
        Thread t = new Thread() {
            public void run() {
                try {
                    InOut me = (InOut) channel.accept(5000);
                    NormalizedMessage nm = me.createMessage();
                    nm.setContent(new StringSource("<response/>"));
                    me.setOutMessage(nm);
                    channel.sendSync(me);
                    success.set(true);
                    done.set(true);
View Full Code Here

        };
        t.start();

        MessageExchangeFactory factory = channel.createExchangeFactoryForService(new QName("service"));
        InOut me = factory.createInOutExchange();
        NormalizedMessage nm = me.createMessage();
        nm.setContent(new StringSource("<request/>"));
        me.setInMessage(nm);
        channel.sendSync(me);
        assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
        me.setStatus(ExchangeStatus.DONE);
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.