Package org.jboss.soa.esb.client

Examples of org.jboss.soa.esb.client.ServiceInvoker


            Map<URI, Message> messageMap = ms.getAllMessages(MessageStore.CLASSIFICATION_RDLVR);
            for (URI key : messageMap.keySet()) {
                ms.removeMessage(key, MessageStore.CLASSIFICATION_RDLVR);
            }
            Service noneExistingService = new Service("none-exising-category", "none-existing-service-name");
            ServiceInvoker si = new ServiceInvoker(noneExistingService);
            si.deliverAsync(message);
          
            //Adding this control code to show where the message now is.
            Map<URI, Message> rdlvrMessageMap = ms.getAllMessages(MessageStore.CLASSIFICATION_RDLVR);
            while (rdlvrMessageMap.size() == 0) { //we may have to wait for the DLQService to act.
                logger.info("...Waiting for the DLQ Service to act.");
View Full Code Here


     
      Message esbMessage = MessageFactory.getInstance().getMessage();

      esbMessage.getBody().add(args[2]);
     
        new ServiceInvoker(args[0], args[1]).deliverAsync(esbMessage);
     
    }
View Full Code Here

      esbMessage.getHeader().setCall(call);
     
      // set body contents with args[2], and send
      esbMessage.getBody().add(args[2]);
     
        new ServiceInvoker(args[0], args[1]).deliverAsync(esbMessage);
    }
View Full Code Here

            Map<URI, Message> messageMap = ms.getAllMessages(MessageStore.CLASSIFICATION_DLQ);
            for (URI key : messageMap.keySet()) {
                ms.removeMessage(key, MessageStore.CLASSIFICATION_DLQ);
            }
            Service noneExistingService = new Service("none-exising-category", "none-existing-service-name");
            ServiceInvoker si = new ServiceInvoker(noneExistingService);
            si.deliverSync(message, 1000);
        } catch (MessageStoreException mse) {
            throw new ActionProcessingException(mse.getMessage(), mse);
        } catch (MessageDeliverException mde) {
            //Adding this control code to show where the message now is.
            //We should get here on and we should have a message in the DLQ.
View Full Code Here

    }

    public void test_OK() throws Exception {
        AbstractTestRunner testRunner = new AbstractTestRunner() {
            public void test() throws Exception {
                ServiceInvoker invoker = new ServiceInvoker("Services", "ServiceA");
                Message request = MessageFactory.getInstance().getMessage();

                request.getBody().add("Hello");

                ResponseAction.responseMessage = MessageFactory.getInstance().getMessage();
                ResponseAction.responseMessage.getBody().add("Goodbye");

                Message response = invoker.deliverSync(request, 10000);
                assertEquals("Goodbye", response.getBody().get());
            }
        }.setServiceConfig("sync-invoker-config-01.xml");

        testRunner.run();
View Full Code Here

    }

    public void test_async() throws Exception {
        AbstractTestRunner testRunner = new AbstractTestRunner() {
            public void test() throws Exception {
                ServiceInvoker invoker = new ServiceInvoker("ServiceCat", "CallService");
                Message message = MessageFactory.getInstance().getMessage();
                ActionProcessingException exception = new ActionProcessingException("Exception!!!");

                message.getHeader().getCall().setFrom(new LogicalEPR("A", "B"));
                Message faultMessage = Factory.createErrorMessage(Factory.UNEXPECTED_ERROR, message, exception);

                // Should not get a MessageDeliverException...
                invoker.deliverAsync(faultMessage);

                // Mock action should have received faultMessage...
                waitForMockSet(faultMessage);
                assertTrue("Message equality", checkMessageEquality(faultMessage, MockAction.message));
            }
View Full Code Here

    }

    public void test_exception_fail() throws Exception {
        AbstractTestRunner testRunner = new AbstractTestRunner() {
            public void test() throws Exception {
                ServiceInvoker invoker = new ServiceInvoker("Services", "ServiceA");
                Message request = MessageFactory.getInstance().getMessage();

                request.getBody().add("Hello");

                ResponseAction.exception = new ActionProcessingException("Exception!!");

                try {
                    invoker.deliverSync(request, 10000);
                    fail("Expected FaultMessageException");
                } catch(FaultMessageException e) {
                    assertEquals("Error delivering message to service 'Services:ServiceB'", e.getCause().getMessage());
                }
            }
View Full Code Here

    }

    public void test_exception_OK() throws Exception {
        AbstractTestRunner testRunner = new AbstractTestRunner() {
            public void test() throws Exception {
                ServiceInvoker invoker = new ServiceInvoker("Services", "ServiceA");
                Message request = MessageFactory.getInstance().getMessage();

                request.getBody().add("Hello");

                ResponseAction.exception = new ActionProcessingException("Exception!!");

                invoker.deliverSync(request, 10000);
            }
        }.setServiceConfig("sync-invoker-config-02.xml");

        testRunner.run();
    }
View Full Code Here

            public void test() throws Exception {
                SuspendedTransactionStrategy suspendedTxStrategy = new SuspendedTransactionStrategy();

                TransactionStrategy.setTransactionStrategy(suspendedTxStrategy);
                try {
                    ServiceInvoker invoker = new ServiceInvoker("Services", "ServiceA");
                    Message request = MessageFactory.getInstance().getMessage();
                    ResponseAction.responseMessage = MessageFactory.getInstance().getMessage();

                    request.getBody().add("Hello");

                    // Need to deliver async here because we're in a transaction (mock transaction)...
                    invoker.deliverAsync(request);
                    ResponseAction.waitForMessage(10000);
                } finally {
                    TransactionStrategy.setTransactionStrategy(new TransactionStrategy.NullTransactionStrategy());
                }
View Full Code Here

            public void test() throws Exception {
                SuspendedTransactionStrategy suspendedTxStrategy = new SuspendedTransactionStrategy();

                TransactionStrategy.setTransactionStrategy(suspendedTxStrategy);
                try {
                    ServiceInvoker invoker = new ServiceInvoker("Services", "ServiceA");
                    Message request = MessageFactory.getInstance().getMessage();
                    ResponseAction.responseMessage = MessageFactory.getInstance().getMessage();

                    request.getBody().add("Hello");

                    // Need to deliver async here because we're in a transaction (mock transaction)...
                    invoker.deliverAsync(request);
                    ResponseAction.waitForMessage(10000);
                } finally {
                    TransactionStrategy.setTransactionStrategy(new TransactionStrategy.NullTransactionStrategy());
                }
View Full Code Here

TOP

Related Classes of org.jboss.soa.esb.client.ServiceInvoker

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.