Package javax.jbi.messaging

Examples of javax.jbi.messaging.DeliveryChannel


    try {
      AgilaComponent component = AgilaComponent.getInstance();
      if (component == null) {
        throw new IllegalStateException("AgilaComponent is not initialized");
      }
      DeliveryChannel channel = component.getContext().getDeliveryChannel();
      MessageExchangeFactory mef = channel.createExchangeFactory();
      MessageExchange me = mef.createInOnlyExchange();
      me.setInterfaceName(new QName(portType));
      me.setOperation(new QName(operation));
      NormalizedMessage in = me.createMessage();
      in.setContent(new DocumentSource(message));
      me.setMessage(in, "in");
      channel.sendSync(me);
      NormalizedMessage out = me.getMessage("out");
      DocumentResult result = new DocumentResult();
      TransformerFactory.newInstance().newTransformer().transform(out.getContent(), result);
      return result.getDocument();
    } catch (Exception e) {
View Full Code Here


    try {
      AgilaComponent component = AgilaComponent.getInstance();
      if (component == null) {
        throw new IllegalStateException("AgilaComponent is not initialized");
      }
      DeliveryChannel channel = component.getContext().getDeliveryChannel();
      MessageExchangeFactory mef = channel.createExchangeFactory();
      MessageExchange me = mef.createInOnlyExchange();
      me.setInterfaceName(new QName(namespace, portType));
      me.setOperation(new QName(namespace, operation));
      NormalizedMessage in = me.createMessage();
      in.setContent(new DocumentSource(message));
      me.setMessage(in, "in");
      channel.sendSync(me);
      NormalizedMessage out = me.getMessage("out");
      DocumentResult result = new DocumentResult();
      TransformerFactory.newInstance().newTransformer().transform(out.getContent(), result);
      return result.getDocument();
    } catch (Exception e) {
View Full Code Here

    private void startSE() throws JBIException {
        try {
            if (ctx == null) {
                return;
            }
            DeliveryChannel chnl = ctx.getDeliveryChannel();
            configureJBITransportFactory(chnl, suManager);
            LOG.info(new Message("SE.STARTUP.COMPLETE", LOG).toString());
           
        } catch (Throwable e) {
            throw new JBIException(e);
View Full Code Here

     *
     * @param target the bean to be injected
     */
    protected void injectBean(final Object target) {
        final PojoContext ctx = new PojoContext();
        final DeliveryChannel ch = ctx.channel;
        // Inject fields
        ReflectionUtils.doWithFields(target.getClass(), new ReflectionUtils.FieldCallback() {
            public void doWith(Field f) throws IllegalArgumentException, IllegalAccessException {
                ExchangeTarget et = f.getAnnotation(ExchangeTarget.class);
                if (et != null) {
View Full Code Here

            throw new NullPointerException("MEP not found");
        }
        MessageExchangeFactory mef = message.getExchange().get(
                MessageExchangeFactory.class);
        if (mef == null) {
            DeliveryChannel dv = message.getExchange().get(
                    DeliveryChannel.class);
            if (dv == null) {
                ComponentContext cc = message.getExchange().get(
                        ComponentContext.class);
                if (cc == null) {
                    throw new NullPointerException(
                            "MessageExchangeFactory or DeliveryChannel or ComponentContext not found");
                }
                dv = cc.getDeliveryChannel();
            }
            mef = dv.createExchangeFactory();
        }
        MessageExchange me = mef.createExchange(mep);
        me.setOperation(operation.getName());
        return me;
    }
View Full Code Here

        Bus bus = BusFactory.getDefaultBus();
        JBITransportFactory jbiTransportFactory = (JBITransportFactory) bus
                .getExtension(ConduitInitiatorManager.class)
                .getConduitInitiator(CxfSeComponent.JBI_TRANSPORT_ID);
        if (getInternalContext() != null) {
            DeliveryChannel dc = getInternalContext().getDeliveryChannel();
            if (dc != null) {
                jbiTransportFactory.setDeliveryChannel(dc);
            }
        }
        return cf.create();
View Full Code Here

            exchange.setInterfaceName(interfaceName);
        }
        JBIDestination jbiDestination = jbiTransportFactory
                .getDestination(serviceName.toString()
                        + interfaceName.toString());
        DeliveryChannel dc = getContext().getDeliveryChannel();
        jbiTransportFactory.setDeliveryChannel(dc);
       
        jbiDestination.setDeliveryChannel(dc);
        if (exchange.getStatus() == ExchangeStatus.ACTIVE) {
            jbiDestination.getJBIDispatcherUtil().dispatch(exchange);
View Full Code Here

        }
    }

    public void process(Exchange exchange) {
        try {
            DeliveryChannel deliveryChannel = componentContext.getDeliveryChannel();
            MessageExchangeFactory exchangeFactory = deliveryChannel.createExchangeFactory();
            MessageExchange messageExchange = binding.makeJbiMessageExchange(exchange, exchangeFactory, jbiEndpoint.getMep());

            if (jbiEndpoint.getOperation() != null) {
                messageExchange.setOperation(QName.valueOf(jbiEndpoint.getOperation()));
            }

            URIResolver.configureExchange(messageExchange, componentContext, jbiEndpoint.getDestinationUri());
            deliveryChannel.sendSync(messageExchange);

            if (messageExchange.getStatus() == ExchangeStatus.ERROR) {
                exchange.setException(messageExchange.getError());
            } else if (messageExchange.getStatus() == ExchangeStatus.ACTIVE) {
                addHeaders(messageExchange, exchange);
                if (messageExchange.getFault() != null) {
                    exchange.getFault().setBody(messageExchange.getFault().getContent());
                    addHeaders(messageExchange.getFault(), exchange.getFault());
                    addAttachments(messageExchange.getFault(), exchange.getFault());
                } else {
                    exchange.getOut().setBody(messageExchange.getMessage("out").getContent());
                    addHeaders(messageExchange.getMessage("out"), exchange.getOut());
                    addAttachments(messageExchange.getMessage("out"), exchange.getOut());
                }
                messageExchange.setStatus(ExchangeStatus.DONE);
                deliveryChannel.send(messageExchange);
            }

        } catch (MessagingException e) {
            throw new JbiException(e);
        } catch (URISyntaxException e) {
View Full Code Here

        this.destinationUri = destinationUri;
    }

    public void process(Exchange exchange) {
        try {
            DeliveryChannel deliveryChannel = componentContext.getDeliveryChannel();
            MessageExchangeFactory exchangeFactory = deliveryChannel.createExchangeFactory();
            MessageExchange messageExchange = binding.makeJbiMessageExchange(exchange, exchangeFactory);

            URIResolver.configureExchange(messageExchange, componentContext, destinationUri);
            deliveryChannel.sendSync(messageExchange);
        }
        catch (MessagingException e) {
            throw new JbiException(e);
        }
    }
View Full Code Here

    public void testExchangeFactoryOnOpenChannel() throws Exception {
        // Retrieve a delivery channel
        TestComponent component = new TestComponent(null, null);
        container.activateComponent(new ActivationSpec("component", component));
        DeliveryChannel channel = component.getChannel();
        // test
        MessageExchangeFactory mef = channel.createExchangeFactory();
        assertNotNull(mef);
        assertNotNull(mef.createInOnlyExchange());
    }
View Full Code Here

TOP

Related Classes of javax.jbi.messaging.DeliveryChannel

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.