Package javax.jbi.messaging

Examples of javax.jbi.messaging.NormalizedMessage


    public void exchangeSent(ExchangeEvent event) {
        try {
            MessageExchange exchange = event.getExchange();
            if (exchange.getStatus() == ExchangeStatus.ACTIVE) {
                OutputStream os = getOutputStream(exchange);
                NormalizedMessage in = exchange.getMessage("in");
                if (StreamSource.class.isAssignableFrom(in.getContent().getClass())) {
                    StreamSource original = (StreamSource) exchange.getMessage("in").getContent();
                    TeeInputStream tis = new TeeInputStream(original.getInputStream(), os);
                    exchange.getMessage("in").setContent(new StreamSource(tis));
                } else {
                    MessageUtil.enableContentRereadability(in);
                    SourceTransformer transformer = new SourceTransformer();
                    transformer.toResult(in.getContent(), new StreamResult(os));
                }
            }
        } catch (IOException e) {
            LOG.error(String.format("Error occurred while storing message %s", event.getExchange().getExchangeId()), e);
        } catch (TransformerException e) {
View Full Code Here


    protected void processFile(FTPClient ftp, String file) throws Exception {
        InputStream in = ftp.retrieveFileStream(file);
        InOnly exchange = getExchangeFactory().createInOnlyExchange();
        configureExchangeTarget(exchange);
        NormalizedMessage message = exchange.createMessage();
        exchange.setInMessage(message);
        marshaler.readMessage(exchange, message, in, file);
        sendSync(exchange);
        in.close();
        ftp.completePendingCommand();
View Full Code Here

        Receiver r2 = (Receiver) getBean("receiver2");
        Receiver r3 = (Receiver) getBean("receiver3");
        r1.getMessageList().assertMessagesReceived(1);
        r2.getMessageList().assertMessagesReceived(1);
        r3.getMessageList().assertMessagesReceived(1);
        NormalizedMessage nm = (NormalizedMessage) r3.getMessageList().flushMessages().get(0);
        Element e = new SourceTransformer().toDOMElement(nm);
        log.info(new SourceTransformer().contentToString(nm));
        assertEquals("hello", e.getNodeName());
    }
View Full Code Here

        if (logger.isDebugEnabled()) {
            logger.debug("Firing Quartz Job with context: " + context);
        }
        try {
            InOnly exchange = getExchangeFactory().createInOnlyExchange();
            NormalizedMessage message = exchange.createMessage();
            getMarshaler().populateNormalizedMessage(message, context);
            exchange.setInMessage(message);
            configureExchangeTarget(exchange);
            send(exchange);
        } catch (MessagingException e) {
View Full Code Here

        InputStream in = null;
        try {
            String name = aFile.getCanonicalPath();
            in = new BufferedInputStream(new FileInputStream(aFile));
            InOnly exchange = getExchangeFactory().createInOnlyExchange();
            NormalizedMessage message = exchange.createMessage();
            exchange.setInMessage(message);
            marshaler.readMessage(exchange, message, in, name);
            getDeliveryChannel().sendSync(exchange);
        } finally {
            if (in != null) {
View Full Code Here

        msg.put(Binding.class, binding);
        msg.setContent(InputStream.class, getClass().getResourceAsStream("HelloWorld-DOC-Input.xml"));
        msg.put(MessageExchangeFactory.class, new MockExchangeFactory());
        phaseIn.doIntercept(msg);

        NormalizedMessage nm = msg.getContent(NormalizedMessage.class);
        Document doc = DomUtil.parse(nm.getContent());
        baos = new ByteArrayOutputStream();
        DomUtil.getTransformerFactory().newTransformer().transform(nm.getContent(), new StreamResult(baos));
        log.info(baos.toString());
       
        // check jbi message element
        Element root = DomUtil.getFirstChildElement(doc);
        assertNotNull(root);
View Full Code Here

        msg.put(Operation.class, binding.getOperations().iterator().next());
        msg.setContent(InputStream.class, getClass().getResourceAsStream("HelloWorld-DOC-Output.xml"));
        msg.setContent(MessageExchange.class, me);
        phaseIn.doIntercept(msg);

        NormalizedMessage nm = msg.getContent(NormalizedMessage.class);
        Document doc = DomUtil.parse(nm.getContent());
        baos = new ByteArrayOutputStream();
        DomUtil.getTransformerFactory().newTransformer().transform(nm.getContent(), new StreamResult(baos));
        log.info(baos.toString());
       
        // check jbi message element
        Element root = DomUtil.getFirstChildElement(doc);
        assertNotNull(msg);
View Full Code Here

        msg.put(Operation.class, binding.getOperations().iterator().next());
        msg.setContent(InputStream.class, getClass().getResourceAsStream("HelloWorld-DOC-Fault.xml"));
        msg.setContent(MessageExchange.class, new MockMessageExchange());
        phaseIn.doIntercept(msg);

        NormalizedMessage nm = msg.getContent(NormalizedMessage.class);
        Document doc = DomUtil.parse(nm.getContent());
        baos = new ByteArrayOutputStream();
        DomUtil.getTransformerFactory().newTransformer().transform(nm.getContent(), new StreamResult(baos));
        log.info(baos.toString());
       
        Element root = DomUtil.getFirstChildElement(doc);
        assertNotNull(root);
        assertEquals("uri:HelloWorld", root.getNamespaceURI());
View Full Code Here

        msg.put(Binding.class, binding);
        msg.setContent(InputStream.class, getClass().getResourceAsStream("HelloWorld-RPC-Input.xml"));
        msg.put(MessageExchangeFactory.class, new MockExchangeFactory());
        phaseIn.doIntercept(msg);
       
        NormalizedMessage nm = msg.getContent(NormalizedMessage.class);
        Document doc = DomUtil.parse(nm.getContent());

        baos = new ByteArrayOutputStream();
        DomUtil.getTransformerFactory().newTransformer().transform(nm.getContent(), new StreamResult(baos));
        log.info(baos.toString());

        Element root = DomUtil.getFirstChildElement(doc);
        assertNotNull(msg);
        assertEquals(JbiConstants.WSDL11_WRAPPER_NAMESPACE, root.getNamespaceURI());
View Full Code Here

        msg.put(Operation.class, binding.getOperations().iterator().next());
        msg.setContent(InputStream.class, getClass().getResourceAsStream("HelloWorld-RPC-Output.xml"));
        msg.setContent(MessageExchange.class, me);
        phaseIn.doIntercept(msg);

        NormalizedMessage nm = msg.getContent(NormalizedMessage.class);
        Document doc = DomUtil.parse(nm.getContent());

        baos = new ByteArrayOutputStream();
        DomUtil.getTransformerFactory().newTransformer().transform(nm.getContent(), new StreamResult(baos));
        log.info(baos.toString());
       
        // check jbi message element
        Element root = DomUtil.getFirstChildElement(doc);
        assertNotNull(root);
View Full Code Here

TOP

Related Classes of javax.jbi.messaging.NormalizedMessage

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.