Package org.apache.tuscany.core.message

Examples of org.apache.tuscany.core.message.Message


    public MessageDispatcher(Interceptor head) {
        this.head = head;
    }

    public boolean processMessage(Message msg) {
        Message resp = head.invoke(msg);
        msg.getCallbackChannel().send(resp);
        return false;
    }
View Full Code Here


            sourceRequestChannel.send(requestMessage);
        }
        if (targetRequestChannel != null) {
            targetRequestChannel.send(requestMessage);
        }
        Message responseMessage = requestMessage.getRelatedCallbackMessage();
        if (targetResponseChannel != null) {
            targetResponseChannel.send(responseMessage);
        }
        if (sourceResponseChannel != null) {
            sourceResponseChannel.send(responseMessage);
View Full Code Here

            } catch (InvocationTargetException e) {
                // the cause was thrown by the target so throw it
                throw e.getCause();
            }
        } else {
            Message msg = messageFactory.createMessage();
            msg.setTargetInvoker(invoker);
            msg.setBody(args);
            // dispatch the wire down the chain and get the response
            Message resp = headInterceptor.invoke(msg);

            Object body = resp.getBody();
            if (body instanceof Throwable) {
                throw (Throwable) body;
            }
            return body;
        }
View Full Code Here

        source.build();
        target.build();
        MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
        source.setTargetInvoker(invoker);
       
        Message msg = factory.createMessage();
        msg.setTargetInvoker(invoker);
        Message response = source.getHeadInterceptor().invoke(msg);
        Assert.assertTrue(response.getBody() instanceof IllegalArgumentException);
        Assert.assertEquals(1,sourceRequestHandler.getCount());
        Assert.assertEquals(1,sourceResponseHandler.getCount());
        Assert.assertEquals(1,sourceInterceptor.getCount());
        Assert.assertEquals(1,targetRequestHandler.getCount());
        Assert.assertEquals(1,targetResponseHandler.getCount());
View Full Code Here

        source.build();
        target.build();
        MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
        source.setTargetInvoker(invoker);
       
        Message msg = factory.createMessage();
        msg.setTargetInvoker(invoker);
        Message response = source.getHeadInterceptor().invoke(msg);
        Assert.assertTrue(response.getBody() instanceof IllegalArgumentException);
        Assert.assertEquals(1,sourceRequestHandler.getCount());
        Assert.assertEquals(1,sourceInterceptor.getCount());
        Assert.assertEquals(1,targetRequestHandler.getCount());
        Assert.assertEquals(1,targetInterceptor.getCount());
    }
View Full Code Here

        source.build();
        target.build();
        MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
        source.setTargetInvoker(invoker);
       
        Message msg = factory.createMessage();
        msg.setTargetInvoker(invoker);
        Message response = source.getHeadInterceptor().invoke(msg);
        Assert.assertTrue(response.getBody() instanceof IllegalArgumentException);
        Assert.assertEquals(1,sourceInterceptor.getCount());
        Assert.assertEquals(1,targetInterceptor.getCount());

    }
View Full Code Here

        source.build();
        target.build();
        MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
        source.setTargetInvoker(invoker);

        Message msg = factory.createMessage();
        msg.setBody("foo");
        msg.setTargetInvoker(invoker);
        Message response = source.getHeadInterceptor().invoke(msg);
        Assert.assertEquals("foo", response.getBody());
        Assert.assertEquals(1, sourceRequestHandler.getCount());
        Assert.assertEquals(1, sourceResponseHandler.getCount());
        Assert.assertEquals(1, sourceInterceptor.getCount());
        Assert.assertEquals(1, targetRequestHandler.getCount());
        Assert.assertEquals(1, targetResponseHandler.getCount());
View Full Code Here

        source.build();
        target.build();
        MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
        source.setTargetInvoker(invoker);

        Message msg = factory.createMessage();
        msg.setBody("foo");
        msg.setTargetInvoker(invoker);
        Message response = source.getHeadInterceptor().invoke(msg);
        Assert.assertEquals("foo", response.getBody());
        Assert.assertEquals(1, sourceRequestHandler.getCount());
        Assert.assertEquals(1, sourceInterceptor.getCount());
        Assert.assertEquals(1, targetRequestHandler.getCount());
        Assert.assertEquals(1, targetInterceptor.getCount());
    }
View Full Code Here

        target.build();
        // set a static invoker
        MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
        source.setTargetInvoker(invoker);

        Message msg = msgFactory.createMessage();
        msg.setBody("foo");
        msg.setTargetInvoker(invoker);
        Message response = source.getHeadInterceptor().invoke(msg);
        Assert.assertEquals("foo", response.getBody());
        Assert.assertEquals(1, sourceRequestHandler.getCount());
        Assert.assertEquals(1, sourceResponseHandler.getCount());
        Assert.assertEquals(1, sourceInterceptor.getCount());
        Assert.assertEquals(1, targetInterceptor.getCount());
    }
View Full Code Here

        target.build();
        // set a static invoker
        MockStaticInvoker invoker = new MockStaticInvoker(hello, new SimpleTargetImpl());
        source.setTargetInvoker(invoker);

        Message msg = msgFactory.createMessage();
        msg.setBody("foo");
        msg.setTargetInvoker(invoker);
        Message response = source.getHeadInterceptor().invoke(msg);
        Assert.assertEquals("foo", response.getBody());
        Assert.assertEquals(1, targetRequestHandler.getCount());
        Assert.assertEquals(1, targetResponseHandler.getCount());
        Assert.assertEquals(1, targetInterceptor.getCount());
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.core.message.Message

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.