You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by martymusk <ma...@email.it> on 2008/01/04 12:22:59 UTC

Consumer Can Send

Hy,
I've a question...
can I set anywhere Consumer to CAN_SEND?

I hope you can help me.
Thank you in advance.

Martina
-- 
View this message in context: http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Consumer Can Send

Posted by Guillaume Nodet <gn...@gmail.com>.
Sure thing: an exchange which is received in an Error or Done state is
terminated and can not be sent again.

On Jan 7, 2008 2:06 PM, martymusk <ma...@email.it> wrote:

>
> It's possible it can't send, because status exchange is done?
>
> Martina
>
>
> martymusk wrote:
> >
> > Thank you very much...
> > The exception is the same, I post it:
> >
> > INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> > INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> > INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> > INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
> InOnly[
> >   id: ID:192.168.0.172-11754495367-2:0
> >   status: Done
> >   role: provider
> >   endpoint: endpoint
> >   in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> > xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> > xmlns="http://www.w3.org/2005/08/addressing"
> > xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> > xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> > xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
> Example
> > Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> > Job</fullname><description/><fireTime>Mon Jan 07 13:46:56 CET
> >
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> > ]
> > INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> > INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> > INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
> > INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> > INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> > INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> > DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> > INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> > INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus status
> =
> > getStatus()
> > INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
> > STATO
> > INFO  - MessageExchangeImpl            - TERMINA handleSend
> > INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
> > INFO  - DeliveryChannelImpl            - DOPO DI
> > mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> > INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> > DEBUG - JMSFlow                        - Called Flow send
> > DEBUG - ActiveMQSession                - Sending message:
> > ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> messageId
> > = ID:martina-39867-1199709997721-3:0:1:1:7, originalDestination = null,
> > originalTransactionId = null, producerId =
> > ID:martina-39867-1199709997721-3:0:1:1, destination =
> > queue://org.apache.servicemix.jms.{
> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> ,
> > transactionId = null, expiration = 0, timestamp = 1199710016807, arrival
> =
> > 0, correlationId = null, replyTo = null, persistent = true, type = null,
> > priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
> null,
> > compressed = false, userID = null, content =
> > org.apache.activemq.util.ByteSequence@5ac5f, marshalledProperties =
> null,
> > dataStructure = null, redeliveryCounter = 0, size = 0, properties =
> null,
> > readOnlyProperties = true, readOnlyBody = true, droppable = false}
> > INFO  - DeliveryChannelImpl            - DOPO
> > container.sendExchange(mirror);
> > INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> > INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> > INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> > INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> > INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> > INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> > INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> > INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> > INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> > DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> > INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> > INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> > INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> > INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> > INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> > INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> > INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> > INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> > INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> > INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> > DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> > INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> > INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> > ERROR - JMSFlow                        - Caught an exception routing
> > ExchangePacket:
> > javax.jbi.messaging.MessagingException: illegal call to send / sendSync
> >       at
> > org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> MessageExchangeImpl.java:581)
> >       at
> > org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> DeliveryChannelImpl.java:384)
> >       at
> > org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> DeliveryChannelImpl.java:444)
> >       at
> > org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
> :249)
> >       at
> > org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> SubscriberComponent.java:204)
> >       at
> > org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> DeliveryChannelImpl.java:621)
> >       at
> > org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> AbstractFlow.java:174)
> >       at
> > org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(JMSFlow.java:1)
> >       at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
> JMSFlow.java:543)
> >       at
> >
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> (ThreadPoolExecutor.java:665)
> >       at
> >
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> (ThreadPoolExecutor.java:690)
> >       at java.lang.Thread.run(Thread.java:595)
> > javax.jbi.messaging.MessagingException: illegal call to send / sendSync
> >       at
> > org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> MessageExchangeImpl.java:581)
> >       at
> > org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> DeliveryChannelImpl.java:384)
> >       at
> > org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> DeliveryChannelImpl.java:444)
> >       at
> > org.apache.servicemix.components.util.PojoSupport.done(PojoSupport.java
> :193)
> >       at
> > org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> SubscriberComponent.java:198)
> >       at
> > org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> DeliveryChannelImpl.java:621)
> >       at
> > org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> AbstractFlow.java:174)
> >       at
> > org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(JMSFlow.java:1)
> >       at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
> JMSFlow.java:543)
> >       at
> >
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> (ThreadPoolExecutor.java:665)
> >       at
> >
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> (ThreadPoolExecutor.java:690)
> >       at java.lang.Thread.run(Thread.java:595)
> >
> > What do I do wrong?
> > Thanks in advance!
> >
> > Martina
> >
> >
> > gnodet wrote:
> >>
> >> Just before calling fail(exchange, e), could you display the stack
> trace
> >> of
> >> the exception ?
> >>    e.printStackTrace()
> >> and send this error ?
> >> This is the real error, but it seems to be hidden by fail() throwing
> >> another
> >> excepiton.
> >>
> >> On Jan 7, 2008 12:32 PM, martymusk <ma...@email.it> wrote:
> >>
> >>>
> >>> Hy gnodet,
> >>> thank you for your felpfulness.
> >>> Thus, I've used InOnly exchange, but I've the same error.
> >>> I post you my class and the error.
> >>>
> >>> package org.apache.servicemix.wsn;
> >>>
> >>>
> >>> import java.io.StringWriter;
> >>>
> >>> import javax.jbi.JBIException;
> >>> import javax.jbi.messaging.ExchangeStatus;
> >>> import javax.jbi.messaging.MessageExchange;
> >>> import javax.jbi.messaging.MessagingException;
> >>> import javax.jbi.messaging.NormalizedMessage;
> >>> import javax.xml.bind.JAXBContext;
> >>> import javax.xml.transform.Source;
> >>> import javax.xml.transform.TransformerException;
> >>>
> >>> import org.apache.commons.logging.Log;
> >>> import org.apache.commons.logging.LogFactory;
> >>> import org.apache.servicemix.MessageExchangeListener;
> >>> import org.apache.servicemix.components.util.ComponentSupport;
> >>> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
> >>> import org.apache.servicemix.jbi.jaxp.StringSource;
> >>> import org.apache.servicemix.wsn.client.AbstractWSAClient;
> >>> import org.apache.servicemix.wsn.client.NotificationBroker;
> >>> import org.oasis_open.docs.wsn.b_2.Subscribe;
> >>> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
> >>> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
> >>> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
> >>> import org.w3c.dom.Element;
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>  public class SubscriberComponent extends ComponentSupport implements
> >>> MessageExchangeListener {
> >>>
> >>>            private static final Log log =
> >>> LogFactory.getLog(SubscriberComponent.class);
> >>>
> >>>            private NotificationBroker wsnBroker;
> >>>            private String receiveTopic;
> >>>            private boolean demand;
> >>>            private String subscriptionEndpoint = "subscription";
> >>>            private Subscribe subscription;
> >>>
> >>>            /**
> >>>             * @return Returns the demand.
> >>>             */
> >>>            public boolean getDemand() {
> >>>                return demand;
> >>>            }
> >>>
> >>>            /**
> >>>             * @param demand The demand to set.
> >>>             */
> >>>            public void setDemand(boolean demand) {
> >>>                this.demand = demand;
> >>>            }
> >>>
> >>>            /**
> >>>             * @return Returns the topic.
> >>>             */
> >>>            public String getTopic() {
> >>>                return receiveTopic;
> >>>            }
> >>>
> >>>            /**
> >>>             * @param topic The topic to set.
> >>>             */
> >>>            public void setTopic(String receiveTopic) {
> >>>                this.receiveTopic = receiveTopic;
> >>>            }
> >>>
> >>>            /**
> >>>             * @return Returns the subscription.
> >>>             */
> >>>            public Subscribe getSubscription() {
> >>>                return subscription;
> >>>            }
> >>>
> >>>            /* (non-Javadoc)
> >>>             * @see
> >>> org.apache.servicemix.jbi.management.BaseLifeCycle#init
> >>> ()
> >>>             */
> >>>            public void init() throws JBIException {
> >>>                super.init();
> >>>                getContext().activateEndpoint(getService(),
> >>> subscriptionEndpoint);
> >>>            }
> >>>
> >>>            /* (non-Javadoc)
> >>>             * @see javax.jbi.management.LifeCycleMBean#start()
> >>>             */
> >>>            public void start() throws JBIException {
> >>>                new Thread() {
> >>>                    public void run() {
> >>>                        try {
> >>>                            wsnBroker = new
> >>> NotificationBroker(getContext());
> >>>                            String wsaAddress =
> >>> getService().getNamespaceURI() +
> >>> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
> >>>
> >>> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
> >>>                                                        receiveTopic,
> >>>                                                        demand);
> >>>                        } catch (Exception e) {
> >>>                            log.error("Could not create wsn client",
> e);
> >>>                        }
> >>>                    }
> >>>                }.start();
> >>>            }
> >>>
> >>>
> >>>            private SourceTransformer sourceTransformer = new
> >>> SourceTransformer();
> >>>
> >>>            public SourceTransformer getSourceTransformer() {
> >>>                        return sourceTransformer;
> >>>                }
> >>>
> >>>                public void setSourceTransformer(SourceTransformer
> >>> sourceTransformer) {
> >>>                        this.sourceTransformer = sourceTransformer;
> >>>                }
> >>>
> >>>            /* (non-Javadoc)
> >>>             * @see javax.jbi.management.LifeCycleMBean#shutDown()
> >>>             */
> >>>            public void shutDown() throws JBIException {
> >>>                super.shutDown();
> >>>            }
> >>>
> >>>            /* (non-Javadoc)
> >>>             * @see
> >>> org.apache.servicemix.MessageExchangeListener#onMessageExchange(
> >>> javax.jbi.messaging.MessageExchange)
> >>>             */
> >>>            public void onMessageExchange(MessageExchange exchange)
> >>> throws
> >>> MessagingException {
> >>>
> >>>                NormalizedMessage message = exchange.getMessage("in");
> >>>                        if (message == null) {
> >>>                                log.warn("Received null message from
> >>> exchange: " + exchange);
> >>>                        } else {
> >>>                                log.info("Exchange: " + exchange + "
> >>> received IN message: "
> >>>                                                + message);
> >>>                                try {
> >>>                                        log.info("Body is: "
> >>>                                                        +
> >>> sourceTransformer.toString(message.getContent()));
> >>>                                } catch (TransformerException e) {
> >>>                                        log.error("Failed to turn
> message
> >>> body into text: " + e, e);
> >>>                                }
> >>>                        }
> >>>                        done(exchange);
> >>>                        log.info("MESSAGGIO RICEVUTO");
> >>>
> >>>                  log.info("COPIO IL PACCHETTO");
> >>>
> >>>                        MessageExchange scambio =
> >>> (MessageExchange)exchange;
> >>>                        log.info("IL PACCHETTO COPIATO E': " +scambio);
> >>>
> >>>
> >>>                if (exchange.getStatus() != ExchangeStatus.DONE) {
> >>>                        log.info("RITORNA PERCHE' LO STATO E': "
> >>> +exchange.getStatus());
> >>>                    return;
> >>>                }
> >>>                // This is a notification from the WSN broker
> >>>                if
> >>> (exchange.getEndpoint
> ().getEndpointName().equals(subscriptionEndpoint))
> >>> {
> >>>                    try {
> >>>                        JAXBContext jaxbContext =
> >>> JAXBContext.newInstance(Subscribe.class);
> >>>                        Source src = exchange.getMessage
> >>> ("in").getContent();
> >>>                        Object input =
> >>> jaxbContext.createUnmarshaller().unmarshal(src);
> >>>                        if (input instanceof Subscribe) {
> >>>                            subscription = (Subscribe) input;
> >>>                            SubscribeResponse response = new
> >>> SubscribeResponse();
> >>>                            String wsaAddress =
> >>> getService().getNamespaceURI() +
> >>> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
> >>>
> >>> response.setSubscriptionReference(AbstractWSAClient.createWSA
> >>> (wsaAddress));
> >>>                            StringWriter writer = new StringWriter();
> >>>                            jaxbContext.createMarshaller
> >>> ().marshal(response,
> >>> writer);
> >>>                            NormalizedMessage out =
> >>> exchange.createMessage
> >>> ();
> >>>                            out.setContent(new
> >>> StringSource(writer.toString
> >>> ()));
> >>>                            exchange.setMessage(out, "out");
> >>>                            send(exchange);
> >>>
> >>>                        } else if (input instanceof Unsubscribe) {
> >>>                            subscription = null;
> >>>                            UnsubscribeResponse response = new
> >>> UnsubscribeResponse();
> >>>                            StringWriter writer = new StringWriter();
> >>>                            jaxbContext.createMarshaller
> >>> ().marshal(response,
> >>> writer);
> >>>                            NormalizedMessage out =
> >>> exchange.createMessage
> >>> ();
> >>>                            out.setContent(new
> >>> StringSource(writer.toString
> >>> ()));
> >>>                            exchange.setMessage(out, "out");
> >>>                            send(exchange);
> >>>
> >>>
> >>>                        } else {
> >>>                            throw new Exception("Unkown request");
> >>>                        }
> >>>                    } catch (Exception e) {
> >>>                        fail(exchange, e);
> >>>                    }
> >>>                // This is a notification to publish
> >>>                }
> >>>
> >>>                  else {
> >>>                    try {
> >>>                        if (!demand || subscription != null) {
> >>>                            Element elem = new
> >>> SourceTransformer().toDOMElement(exchange.getMessage("in"));
> >>>                            wsnBroker.notify(receiveTopic, elem);
> >>>                            done(exchange);
> >>>                        } else {
> >>>                            log.info("Ingore notification as the
> >>> publisher
> >>> is no
> >>> subscribers");
> >>>                        }
> >>>                    } catch (Exception e) {
> >>>                        fail(exchange, e);
> >>>                        }
> >>>                }
> >>>            }
> >>>
> >>>  }
> >>>
> >>>  ......
> >>> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >>> DEBUG - JMSFlow                        - Called Flow send
> >>> DEBUG - ActiveMQSession                - Sending message:
> >>> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> >>> messageId
> >>> =
> >>> ID:martina-39597-1199704995676-3:0:1:1:5, originalDestination = null,
> >>> originalTransactionId = null, producerId =
> >>> ID:martina-39597-1199704995676-3:0:1:1, destination =
> >>> queue://org.apache.servicemix.jms.{
> >>> http://servicemix.apache.org/demo}trace:endpoint<http://servicemix.apache.org/demo%7Dtrace:endpoint>
> <http://servicemix.apache.org/demo%7Dtrace:endpoint>
> >>> ,
> >>> transactionId = null, expiration = 0, timestamp = 1199705011173,
> arrival
> >>> =
> >>> 0, correlationId = null, replyTo = null, persistent = true, type =
> null,
> >>> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
> >>> null,
> >>> compressed = false, userID = null, content =
> >>> org.apache.activemq.util.ByteSequence@10a69f0, marshalledProperties =
> >>> null,
> >>> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
> >>> null,
> >>> readOnlyProperties = true, readOnlyBody = true, droppable = false}
> >>> INFO  - SubscriberComponent            - Exchange: InOnly[
> >>>  id: ID:192.168.0.172-11753fdefba-2:0
> >>>  status: Active
> >>>  role: provider
> >>>  endpoint: endpoint
> >>>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> >>> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> >>> xmlns="http://www.w3.org/2005/08/addressing"
> >>> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >>> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >>>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >>> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
> >>> Example
> >>> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> >>> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
> >>>
> >>>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >>> ] received IN message:
> >>>
> >>>
> org.apache.servicemix.jbi.messaging.NormalizedMessageImpl@b125bd{properties
> >>> :
> >>> {}}
> >>> INFO  - SubscriberComponent            - Body is: <?xml version="1.0"
> >>> encoding="UTF-8"?><ns2:Notify xmlns:ns2="
> >>> http://docs.oasis-open.org/wsn/b-2"
> >>> xmlns="http://www.w3.org/2005/08/addressing"
> >>> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >>> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >>>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >>> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
> >>> Example
> >>> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> >>> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
> >>>
> >>>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >>> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >>> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >>> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >>> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >>> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >>> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >>> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >>> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >>> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >>> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >>> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
> status
> >>> =
> >>> getStatus()
> >>> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
> >>> STATO
> >>> INFO  - MessageExchangeImpl            - TERMINA handleSend
> >>> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
> >>> INFO  - DeliveryChannelImpl            - DOPO DI
> >>> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> >>> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >>> DEBUG - JMSFlow                        - Called Flow send
> >>> INFO  - DeliveryChannelImpl            - DOPO
> >>> container.sendExchange(mirror);
> >>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >>> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> >>> DEBUG - ActiveMQSession                - Sending message:
> >>> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> >>> messageId
> >>> =
> >>> ID:martina-39597-1199704995676-3:0:1:1:6, originalDestination = null,
> >>> originalTransactionId = null, producerId =
> >>> ID:martina-39597-1199704995676-3:0:1:1, destination =
> >>> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
> expiration
> >>> =
> >>> 0, timestamp = 1199705011183, arrival = 0, correlationId = null,
> replyTo
> >>> =
> >>> null, persistent = true, type = null, priority = 4, groupID = null,
> >>> groupSequence = 0, targetConsumerId = null, compressed = false, userID
> =
> >>> null, content = org.apache.activemq.util.ByteSequence@c70f32,
> >>> marshalledProperties = null, dataStructure = null, redeliveryCounter =
> >>> 0,
> >>> size = 0, properties = null, readOnlyProperties = true, readOnlyBody =
> >>> true,
> >>> droppable = false}
> >>> INFO  - DeliveryChannelImpl            - DOPO
> >>> container.sendExchange(mirror);
> >>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >>> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> >>> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> >>> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> >>> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
> >>> InOnly[
> >>>  id: ID:192.168.0.172-11753fdefba-2:0
> >>>  status: Done
> >>>  role: provider
> >>>  endpoint: endpoint
> >>>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> >>> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> >>> xmlns="http://www.w3.org/2005/08/addressing"
> >>> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >>> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >>>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >>> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
> >>> Example
> >>> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> >>> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
> >>>
> >>>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >>> ]
> >>> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >>> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >>> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
> >>> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >>> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >>> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >>> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >>> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >>> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
> status
> >>> =
> >>> getStatus()
> >>> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
> >>> STATO
> >>> INFO  - MessageExchangeImpl            - TERMINA handleSend
> >>> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
> >>> INFO  - DeliveryChannelImpl            - DOPO DI
> >>> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> >>> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >>> DEBUG - JMSFlow                        - Called Flow send
> >>> DEBUG - WSNSpringComponent             - Received exchange: status:
> >>> Done,
> >>> role: consumer
> >>> DEBUG - WSNSpringComponent             - Retrieved correlation id:
> null
> >>> DEBUG - ActiveMQSession                - Sending message:
> >>> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> >>> messageId
> >>> =
> >>> ID:martina-39597-1199704995676-3:0:1:1:7, originalDestination = null,
> >>> originalTransactionId = null, producerId =
> >>> ID:martina-39597-1199704995676-3:0:1:1, destination =
> >>> queue://org.apache.servicemix.jms.{
> >>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >>> ,
> >>> transactionId = null, expiration = 0, timestamp = 1199705011188,
> arrival
> >>> =
> >>> 0, correlationId = null, replyTo = null, persistent = true, type =
> null,
> >>> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
> >>> null,
> >>> compressed = false, userID = null, content =
> >>> org.apache.activemq.util.ByteSequence@1c8f59c, marshalledProperties =
> >>> null,
> >>> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
> >>> null,
> >>> readOnlyProperties = true, readOnlyBody = true, droppable = false}
> >>> INFO  - DeliveryChannelImpl            - DOPO
> >>> container.sendExchange(mirror);
> >>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >>> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >>> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >>> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >>> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >>> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >>> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >>> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >>> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >>> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >>> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >>> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >>> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >>> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >>> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >>> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >>> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >>> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >>> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >>> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >>> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >>> ERROR - JMSFlow                        - Caught an exception routing
> >>> ExchangePacket:
> >>> javax.jbi.messaging.MessagingException: illegal call to send /
> sendSync
> >>>        at
> >>> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> >>> MessageExchangeImpl.java:581)
> >>>        at
> >>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> >>> DeliveryChannelImpl.java:384)
> >>>        at
> >>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> >>> DeliveryChannelImpl.java:444)
> >>>        at
> >>> org.apache.servicemix.components.util.PojoSupport.fail(
> PojoSupport.java
> >>> :249)
> >>>        at
> >>> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> >>> SubscriberComponent.java:203)
> >>>        at
> >>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound
> (
> >>> DeliveryChannelImpl.java:621)
> >>>        at
> >>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> >>> AbstractFlow.java:174)
> >>>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
> >>> JMSFlow.java:1)
> >>>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
> >>> JMSFlow.java:543)
> >>>        at
> >>>
> >>>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> >>> (ThreadPoolExecutor.java:665)
> >>>        at
> >>>
> >>>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> >>> (ThreadPoolExecutor.java:690)
> >>>        at java.lang.Thread.run(Thread.java:595)
> >>>
> >>> Can you help me again?
> >>> Thanks in advance!
> >>>
> >>> Martina
> >>>
> >>>
> >>>
> >>> gnodet wrote:
> >>> >
> >>> > You need to use an InOnly or RobustInOnly exchange, not an InOut
> >>> exchange,
> >>> > as notifications do not have any out messages.
> >>> >
> >>> > On Jan 4, 2008 5:16 PM, martymusk <ma...@email.it> wrote:
> >>> >
> >>> >>
> >>> >> Thus , I've created a new class "SubscriberComponent" that is a
> copy
> >>> of
> >>> >> PublisherComponent. Trhough it instance2 receive exchange and try
> to
> >>> send
> >>> >> scambio (copy of exchange). When I run example the following error
> >>> >> occurs...
> >>> >>
> >>> >> DEBUG - JMSFlow                        - Called Flow send
> >>> >> DEBUG - ActiveMQSession                - Sending message:
> >>> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> >>> messageId
> >>> >> =
> >>> >> ID:martina-38529-1199462112612-3:0:1:1:6, originalDestination =
> null,
> >>> >> originalTransactionId = null, producerId =
> >>> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
> >>> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
> >>> expiration
> >>> >> =
> >>> >> 0, timestamp = 1199462153935, arrival = 0, correlationId = null,
> >>> replyTo
> >>> >> =
> >>> >> null, persistent = true, type = null, priority = 4, groupID = null,
> >>> >> groupSequence = 0, targetConsumerId = null, compressed = false,
> >>> userID
> >>> =
> >>> >> null, content = org.apache.activemq.util.ByteSequence@b2175,
> >>> >> marshalledProperties = null, dataStructure = null,
> redeliveryCounter
> >>> =
> >>> 0,
> >>> >> size = 0, properties = null, readOnlyProperties = true,
> readOnlyBody
> >>> =
> >>> >> true,
> >>> >> droppable = false}
> >>> >> DEBUG - WSNSpringComponent             - Received exchange: status:
> >>> >> Active,
> >>> >> role: consumer
> >>> >> DEBUG - WSNSpringComponent             - Retrieved correlation id:
> >>> null
> >>> >> INFO  - DeliveryChannelImpl            - DOPO
> >>> >> container.sendExchange(mirror);
> >>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >>> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> >>> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> >>> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> >>> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
> >>> InOut[
> >>> >>  id: ID:192.168.0.172-1174583cdf9-2:0
> >>> >>  status: Active
> >>> >>  role: provider
> >>> >>  endpoint: endpoint
> >>> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> >>> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> >>> >> xmlns="http://www.w3.org/2005/08/addressing"
> >>> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >>> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >>> >>
> >>>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >>> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
> >>> >> Example
> >>> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> >>> >> Job</fullname><description/><fireTime>Fri Jan 04 16:55:53 CET
> >>> >>
> >>> >>
> >>>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >>> >> ]
> >>> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
> >>> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >>> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >>> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >>> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >>> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >>> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
> >>> status
> >>> =
> >>> >> getStatus()
> >>> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA
> LO
> >>> >> STATO
> >>> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
> >>> >> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend
> (sync)
> >>> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >>> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> >>> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >>> >> DEBUG - JMSFlow                        - Called Flow send
> >>> >> DEBUG - ActiveMQSession                - Sending message:
> >>> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> >>> messageId
> >>> >> =
> >>> >> ID:martina-38529-1199462112612-3:0:1:1:7, originalDestination =
> null,
> >>> >> originalTransactionId = null, producerId =
> >>> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
> >>> >> queue://org.apache.servicemix.jms.{
> >>> >>
> >>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >>> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >>> >> ,
> >>> >> transactionId = null, expiration = 0, timestamp = 1199462153952,
> >>> arrival
> >>> >> =
> >>> >> 0, correlationId = null, replyTo = null, persistent = true, type =
> >>> null,
> >>> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
> >>> null,
> >>> >> compressed = false, userID = null, content =
> >>> >> org.apache.activemq.util.ByteSequence@779b3e, marshalledProperties
> =
> >>> >> null,
> >>> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
> >>> null,
> >>> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
> >>> >> INFO  - DeliveryChannelImpl            - DOPO
> >>> >> container.sendExchange(mirror);
> >>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >>> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >>> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >>> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >>> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >>> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >>> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >>> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >>> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >>> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >>> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >>> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >>> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >>> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >>> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >>> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >>> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >>> >> ERROR - JMSFlow                        - Caught an exception
> routing
> >>> >> ExchangePacket:
> >>> >> javax.jbi.messaging.MessagingException: illegal call to send /
> >>> sendSync
> >>> >>        at
> >>> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> >>> >> MessageExchangeImpl.java:581)
> >>> >>        at
> >>> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> >>> >> DeliveryChannelImpl.java:384)
> >>> >>        at
> >>> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> >>> >> DeliveryChannelImpl.java:444)
> >>> >>        at
> >>> >>
> >>> org.apache.servicemix.components.util.PojoSupport.fail(
> PojoSupport.java
> >>> >> :249)
> >>> >>        at
> >>> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> >>> >> SubscriberComponent.java:203)
> >>> >>        at
> >>> >>
> >>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound
> (
> >>> >> DeliveryChannelImpl.java:621)
> >>> >>        at
> >>> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> >>> >> AbstractFlow.java:174)
> >>> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
> >>> >> JMSFlow.java:1)
> >>> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
> >>> >> JMSFlow.java:543)
> >>> >>        at
> >>> >>
> >>> >>
> >>>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> >>> >> (ThreadPoolExecutor.java:665)
> >>> >>        at
> >>> >>
> >>> >>
> >>>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> >>> >> (ThreadPoolExecutor.java:690)
> >>> >>        at java.lang.Thread.run(Thread.java:595)
> >>> >>
> >>> >> I do wrong again?
> >>> >>
> >>> >> Thank you!!!
> >>> >> Martina
> >>> >>
> >>> >>
> >>> >> gnodet wrote:
> >>> >> >
> >>> >> > You should have a look at the existing code:
> >>> >> >
> >>> >> >
> >>> >>
> >>>
> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/spring/PublisherComponent.java?r=602828
> >>> >> >
> >>> >> > Note that the publisher component actually use the client api
> (line
> >>> >> 172).
> >>> >> > For details on thow the client api works (which is how to send a
> >>> JBI
> >>> >> > exchange to the WSN broker), see:
> >>> >> >
> >>> >> >
> >>> >>
> >>>
> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/client/NotificationBroker.java?r=602828#l89
> >>> >> >
> >>> >> > I would advise you to start from the publisher component, copy it
> >>> and
> >>> >> use
> >>> >> > it
> >>> >> > instead of your TraceComponent.
> >>> >> > Each time it receives a JBI exchange, it will publish it through
> >>> the
> >>> >> > WSNotification broker.
> >>> >> >
> >>> >> > Also look at the various resources on the web site that may help
> >>> you:
> >>> >> >   http://servicemix.apache.org/servicemix-wsn2005.html
> >>> >> >   http://servicemix.apache.org/example-scenario.html
> >>> >> >
> >>> >> >
> >>> >> >
> >>> >> > On Jan 4, 2008 2:58 PM, martymusk <ma...@email.it> wrote:
> >>> >> >
> >>> >> >>
> >>> >> >> Hy gnodet and thank you very much for your helpfulness,
> >>> >> >> but I don't understand exactly what I must to do.
> >>> >> >>
> >>> >> >> How can I send JBI exchange to the WSN broker directly?
> >>> >> >> How can I use WSN client api.
> >>> >> >>
> >>> >> >> I'm working for a thesis at University of Naples.
> >>> >> >> My purpose is to study WSN performance.
> >>> >> >> I've found your WSN implementation very useful for me, but to
> >>> study
> >>> >> >> performance, I need exchange was send back.
> >>> >> >> It is more than a mounth I'm triyng to do this.
> >>> >> >>
> >>> >> >> I would be very grateful if you can help me. Otherwise, there
> are
> >>> no
> >>> >> >> problems, I'll keep on study over and over again, hoping I be
> able
> >>> to
> >>> >> >> achieve my purpose.
> >>> >> >>
> >>> >> >> Thank you very much.
> >>> >> >> Martina
> >>> >> >>
> >>> >> >>
> >>> >> >>
> >>> >> >> gnodet wrote:
> >>> >> >> >
> >>> >> >> > I thought I pointed you to the right direction.
> >>> >> >> > Do not use the PublisherComponent that way: either use it as
> it
> >>> is
> >>> >> >> > intended
> >>> >> >> > (deploy it as a component onto the lightweight container) or
> use
> >>> the
> >>> >> >> WSN
> >>> >> >> > client api:
> >>> >> >> >    wsn.notify(topic, msg)
> >>> >> >> >
> >>> >> >> > I'm not sure what you are trying to achieve with your
> >>> >> TraceComponent.
> >>> >> >>  It
> >>> >> >> > sounds like you want to reimplement the PublisherComponent.
>  If
> >>> so,
> >>> >> you
> >>> >> >> > should have a look at how it is implemented and patch it.
> >>> >> >> >
> >>> >> >> > Also note that both PublisherComponent and the WSN client api
> >>> are
> >>> >> just
> >>> >> >> > sugar, you can send a JBI exchange to the WSN broker directly
> if
> >>> you
> >>> >> >> want.
> >>> >> >> >
> >>> >> >> > On Jan 4, 2008 2:13 PM, martymusk <ma...@email.it> wrote:
> >>> >> >> >
> >>> >> >> >>
> >>> >> >> >> My problem is always the same!
> >>> >> >> >> In wsn-example, after Consumer received an exchange, I'd like
> >>> it
> >>> >> send
> >>> >> >> >> copy
> >>> >> >> >> of it. But it doesn't happen. :-(
> >>> >> >> >> I've modified TraceComponent class in the following way, but
> it
> >>> >> >> doesn't
> >>> >> >> >> work
> >>> >> >> >> fine:
> >>> >> >> >>
> >>> >> >> >>
> >>> >> >> >> package org.apache.servicemix.wsn;
> >>> >> >> >>
> >>> >> >> >> import java.io.StringWriter;
> >>> >> >> >>
> >>> >> >> >> import javax.jbi.JBIException;
> >>> >> >> >> import javax.jbi.messaging.ExchangeStatus;
> >>> >> >> >> import javax.jbi.messaging.MessageExchange;
> >>> >> >> >> import javax.jbi.messaging.MessagingException;
> >>> >> >> >> import javax.jbi.messaging.NormalizedMessage;
> >>> >> >> >> import javax.xml.bind.JAXBContext;
> >>> >> >> >> import javax.xml.transform.Source;
> >>> >> >> >> import javax.xml.transform.TransformerException;
> >>> >> >> >> //import javax.jbi.messaging.InOut;
> >>> >> >> >>
> >>> >> >> >> import
> org.apache.servicemix.jbi.messaging.MessageExchangeImpl;
> >>> >> >> >> import org.apache.servicemix.jbi.messaging.InOutImpl;
> >>> >> >> >> import org.apache.commons.logging.Log;
> >>> >> >> >> import org.apache.commons.logging.LogFactory;
> >>> >> >> >> import org.apache.servicemix.MessageExchangeListener;
> >>> >> >> >> import org.apache.servicemix.components.util.ComponentSupport
> ;
> >>> >> >> >> import org.apache.servicemix.wsn.spring.PublisherComponent;
> >>> >> >> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
> >>> >> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
> >>> >> >> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
> >>> >> >> >> import org.apache.servicemix.wsn.client.NotificationBroker;
> >>> >> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
> >>> >> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
> >>> >> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
> >>> >> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
> >>> >> >> >> import org.w3c.dom.Element;
> >>> >> >> >>
> >>> >> >> >>
> >>> >> >> >> public class TraceComponent extends ComponentSupport
> implements
> >>> >> >> >>                MessageExchangeListener {
> >>> >> >> >>
> >>> >> >> >>
> >>> >> >> >>        private Log log =
> >>> LogFactory.getLog(TraceComponent.class);
> >>> >> >> >>
> >>> >> >> >>        private SourceTransformer sourceTransformer = new
> >>> >> >> >> SourceTransformer();
> >>> >> >> >>
> >>> >> >> >>        public Log getLog() {
> >>> >> >> >>                return log;
> >>> >> >> >>        }
> >>> >> >> >>
> >>> >> >> >>        public void setLog(Log log) {
> >>> >> >> >>                this.log = log;
> >>> >> >> >>        }
> >>> >> >> >>
> >>> >> >> >>        public SourceTransformer getSourceTransformer() {
> >>> >> >> >>                return sourceTransformer;
> >>> >> >> >>        }
> >>> >> >> >>
> >>> >> >> >>        public void setSourceTransformer(SourceTransformer
> >>> >> >> >> sourceTransformer) {
> >>> >> >> >>                this.sourceTransformer = sourceTransformer;
> >>> >> >> >>        }
> >>> >> >> >>
> >>> >> >> >>
> >>> >> >> >>        //AGGIUNGO CODICE
> >>> >> >> >>
> >>> >> >> >>        PublisherComponent publisher = new
> PublisherComponent();
> >>> >> >> >>          private String subscriptionEndpoint =
> "subscription";
> >>> >> >> >>          private NotificationBroker wsnBroker;
> >>> >> >> >>          private String topic;
> >>> >> >> >>          private String msg;
> >>> >> >> >>          private boolean demand;
> >>> >> >> >>          private Subscribe subscription;
> >>> >> >> >>
> >>> >> >> >>
> >>> >> >> >>          public String getTopic() {
> >>> >> >> >>                return topic;
> >>> >> >> >>            }
> >>> >> >> >>
> >>> >> >> >>            /**
> >>> >> >> >>             * @param topic The topic to set.
> >>> >> >> >>             */
> >>> >> >> >>            public void setTopic(String topic) {
> >>> >> >> >>               this.topic = topic;
> >>> >> >> >>            }
> >>> >> >> >>
> >>> >> >> >>         public void init() throws JBIException {
> >>> >> >> >>                super.init();
> >>> >> >> >>                getContext().activateEndpoint(getService(),
> >>> >> >> >> subscriptionEndpoint);
> >>> >> >> >>                 log.info("METODO INIT");
> >>> >> >> >>                // publisher.init();
> >>> >> >> >>
> >>> >> >> >>                 publisher.setTopic(topic);
> >>> >> >> >>            }
> >>> >> >> >>
> >>> >> >> >>            /* (non-Javadoc)
> >>> >> >> >>             * @see javax.jbi.management.LifeCycleMBean#start
> ()
> >>> >> >> >>             */
> >>> >> >> >>            public void start() throws JBIException {
> >>> >> >> >>
> >>> >> >> >>                log.info("METODO START");
> >>> >> >> >>                //publisher.start();
> >>> >> >> >>                new Thread() {
> >>> >> >> >>                  public void run() {
> >>> >> >> >>                       try {
> >>> >> >> >>                           wsnBroker = new
> >>> >> >> >> NotificationBroker(getContext());
> >>> >> >> >>
> >>> >> >> >>                           String wsaAddress =
> >>> >> >> >> getService().getNamespaceURI() + "/"
> >>> >> >> >> + getService().getLocalPart() + "/" + subscriptionEndpoint;
> >>> >> >> >>
> >>> >> >> >>
> >>> >> wsnBroker.registerPublisher(AbstractWSAClient.createWSA
> (wsaAddress),
> >>> >> >> >>                                                       topic,
> >>> >> >> >>
>  demand);
> >>> >> >> >>                        } catch (Exception e) {
> >>> >> >> >>                            log.error("Could not create wsn
> >>> client",
> >>> >> >> e);
> >>> >> >> >>                        }
> >>> >> >> >>                    }
> >>> >> >> >>                }.start();
> >>> >> >> >>            }
> >>> >> >> >>
> >>> >> >> >>
> >>> >> >> >>            public void shutDown() throws JBIException {
> >>> >> >> >>                log.info("METODO SHUTDOWN");
> >>> >> >> >>            //  publisher.shutDown();
> >>> >> >> >>               super.shutDown();
> >>> >> >> >>            }
> >>> >> >> >>
> >>> >> >> >>            //FINE CODICE AGGIUNTO
> >>> >> >> >>
> >>> >> >> >>        public void onMessageExchange(MessageExchange
> exchange)
> >>> >> >> >>                        throws MessagingException {
> >>> >> >> >>                // lets dump the incoming message
> >>> >> >> >>                NormalizedMessage message =
> exchange.getMessage
> >>> >> ("in");
> >>> >> >> >>                if (message == null) {
> >>> >> >> >>                        log.warn("Received null message from
> >>> >> exchange:
> >>> >> >> "
> >>> >> >> +
> >>> >> >> >> exchange);
> >>> >> >> >>                } else {
> >>> >> >> >>                        log.info("Exchange: " + exchange + "
> >>> >> received
> >>> >> >> IN
> >>> >> >> >> message: "
> >>> >> >> >>                                        + message);
> >>> >> >> >>                        try {
> >>> >> >> >>                                log.info("Body is: "
> >>> >> >> >>                                                +
> >>> >> >> >> sourceTransformer.toString(message.getContent()));
> >>> >> >> >>                        } catch (TransformerException e) {
> >>> >> >> >>                                log.error("Failed to turn
> >>> message
> >>> >> body
> >>> >> >> >> into
> >>> >> >> >> text: " + e, e);
> >>> >> >> >>                        }
> >>> >> >> >>                }
> >>> >> >> >>                done(exchange);
> >>> >> >> >>                log.info("MESSAGGIO RICEVUTO");
> >>> >> >> >>
> >>> >> >> >>                log.info("COPIO IL PACCHETTO");
> >>> >> >> >>
> >>> >> >> >>                MessageExchange scambio =
> >>> (MessageExchange)exchange;
> >>> >> >> >>
> >>> >> >> >>
> >>> >> >> >>
> >>> >> >> >>                log.info("INVIO");
> >>> >> >> >>
> >>> >> >> >>          try{
> >>> >> >> >>
> >>> >> >> >>                log.info("FASE INVIO");
> >>> >> >> >>                //publisher.onMessageExchange(scambio);
> >>> >> >> >>
> >>> >> >> >>                //AGGIUNGO onMessageExchange
> >>> >> >> >>
> >>> >> >> >>                if (exchange.getStatus() !=
> >>> ExchangeStatus.ACTIVE)
> >>> {
> >>> >> >> >>                    return;
> >>> >> >> >>                }
> >>> >> >> >>                // This is a notification from the WSN broker
> >>> >> >> >>                if
> >>> >> >> >>
> >>> >> >>
> >>> >>
> >>> (exchange.getEndpoint
> ().getEndpointName().equals(subscriptionEndpoint))
> >>> >> >> {
> >>> >> >> >>                    try {
> >>> >> >> >>                        JAXBContext jaxbContext =
> >>> >> >> >> JAXBContext.newInstance(Subscribe.class);
> >>> >> >> >>                        Source src = exchange.getMessage
> >>> >> >> >> ("in").getContent();
> >>> >> >> >>                        Object input =
> >>> >> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
> >>> >> >> >>                        if (input instanceof Subscribe) {
> >>> >> >> >>                            subscription = (Subscribe) input;
> >>> >> >> >>                            SubscribeResponse response = new
> >>> >> >> >> SubscribeResponse();
> >>> >> >> >>                            String wsaAddress =
> >>> >> >> >> getService().getNamespaceURI() +
> >>> >> >> >> "/" + getService().getLocalPart() + "/" +
> subscriptionEndpoint;
> >>> >> >> >>
> >>> >> >> >> response.setSubscriptionReference(AbstractWSAClient.createWSA
> >>> >> >> >> (wsaAddress));
> >>> >> >> >>                            StringWriter writer = new
> >>> >> StringWriter();
> >>> >> >> >>                            jaxbContext.createMarshaller
> >>> >> >> >> ().marshal(response,
> >>> >> >> >> writer);
> >>> >> >> >>                            NormalizedMessage out =
> >>> >> >> exchange.createMessage
> >>> >> >> >> ();
> >>> >> >> >>                            out.setContent(new
> >>> >> >> >> StringSource(writer.toString
> >>> >> >> >> ()));
> >>> >> >> >>                            exchange.setMessage(out, "out");
> >>> >> >> >>                            send(exchange);
> >>> >> >> >>
> >>> >> >> >>                        } else if (input instanceof
> Unsubscribe)
> >>> {
> >>> >> >> >>                            subscription = null;
> >>> >> >> >>                            UnsubscribeResponse response = new
> >>> >> >> >> UnsubscribeResponse();
> >>> >> >> >>                            StringWriter writer = new
> >>> >> StringWriter();
> >>> >> >> >>                            jaxbContext.createMarshaller
> >>> >> >> >> ().marshal(response,
> >>> >> >> >> writer);
> >>> >> >> >>                            NormalizedMessage out =
> >>> >> >> exchange.createMessage
> >>> >> >> >> ();
> >>> >> >> >>                            out.setContent(new
> >>> >> >> >> StringSource(writer.toString
> >>> >> >> >> ()));
> >>> >> >> >>                            exchange.setMessage(out, "out");
> >>> >> >> >>                            send(exchange);
> >>> >> >> >>
> >>> >> >> >>
> >>> >> >> >>                        } else {
> >>> >> >> >>                            throw new Exception("Unkown
> >>> request");
> >>> >> >> >>                        }
> >>> >> >> >>                    } catch (Exception e) {
> >>> >> >> >>                        fail(exchange, e);
> >>> >> >> >>                    }
> >>> >> >> >>                // This is a notification to publish
> >>> >> >> >>                }
> >>> >> >> >>
> >>> >> >> >>                  else {
> >>> >> >> >>                    try {
> >>> >> >> >>
> >>> >> >> >>                    log.info("SALTA");
> >>> >> >> >>                        if (!demand || subscription != null) {
> >>> >> >> >>                                log.info("ENTRO NELL'IF");
> >>> >> >> >>                           // Element elem = new
> >>> >> >> >> SourceTransformer().toDOMElement(exchange.getMessage("in"));
> >>> >> >> >>                            log.info("PRIMA DI WSNBROKER");
> >>> >> >> >>                            wsnBroker.notify(topic, msg);
> >>> >> >> >>                            log.info("PRIMA DI DONE");
> >>> >> >> >>
>  getDeliveryChannel().send(exchange);
> >>> >> >> >>                            log.info("DOPO DI DONE");
> >>> >> >> >>                        } else {
> >>> >> >> >>                            log.info("Ingore notification as
> the
> >>> >> >> publisher
> >>> >> >> >> is no
> >>> >> >> >> subscribers");
> >>> >> >> >>                        }
> >>> >> >> >>                    } catch (Exception e) {
> >>> >> >> >>                        fail(exchange, e);
> >>> >> >> >>                        }
> >>> >> >> >>
> >>> >> >> >>                log.debug("IL PACCHETTO INVIATO E': " +
> >>> scambio);
> >>> >> >> >>
> >>> >> >> >>                  }
> >>> >> >> >>                //FINE onMessageExchange
> >>> >> >> >>
> >>> >> >> >>           } catch(JBIException e){
> >>> >> >> >>                  log.error("ECCEZIONE GENERATA!");
> >>> >> >> >>          }
> >>> >> >> >>
> >>> >> >> >>      log.info("INVIATO");
> >>> >> >> >> }
> >>> >> >> >> }
> >>> >> >> >>
> >>> >> >> >>
> >>> >> >> >> Help me if you can.
> >>> >> >> >> Thank you very much for your helpfulness...
> >>> >> >> >>
> >>> >> >> >> Martina
> >>> >> >> >>
> >>> >> >> >>
> >>> >> >> >>
> >>> >> >> >>
> >>> >> >> >> gnodet wrote:
> >>> >> >> >> >
> >>> >> >> >> > You should not have to deal nor see the internal state of
> the
> >>> >> >> exchange.
> >>> >> >> >> > If guess you have an exception when trying to send an
> >>> exchange,
> >>> >> but
> >>> >> >> >> this
> >>> >> >> >> > means that there is a problem in your code.  You should
> post
> >>> a
> >>> >> >> snippet
> >>> >> >> >> of
> >>> >> >> >> > your code that is failing so that we can help you.
> >>> >> >> >> >
> >>> >> >> >> > On Jan 4, 2008 12:22 PM, martymusk <ma...@email.it>
> >>> wrote:
> >>> >> >> >> >
> >>> >> >> >> >>
> >>> >> >> >> >> Hy,
> >>> >> >> >> >> I've a question...
> >>> >> >> >> >> can I set anywhere Consumer to CAN_SEND?
> >>> >> >> >> >>
> >>> >> >> >> >> I hope you can help me.
> >>> >> >> >> >> Thank you in advance.
> >>> >> >> >> >>
> >>> >> >> >> >> Martina
> >>> >> >> >> >> --
> >>> >> >> >> >> View this message in context:
> >>> >> >> >> >>
> >>> >> >>
> >>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
> >>> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
> >>> >> Nabble.com.
> >>> >> >> >> >>
> >>> >> >> >> >>
> >>> >> >> >> >
> >>> >> >> >> >
> >>> >> >> >> > --
> >>> >> >> >> > Cheers,
> >>> >> >> >> > Guillaume Nodet
> >>> >> >> >> > ------------------------
> >>> >> >> >> > Blog: http://gnodet.blogspot.com/
> >>> >> >> >> >
> >>> >> >> >> >
> >>> >> >> >>
> >>> >> >> >> --
> >>> >> >> >> View this message in context:
> >>> >> >> >>
> >>> >>
> >>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616107.html
> >>> >> >> >> Sent from the ServiceMix - User mailing list archive at
> >>> Nabble.com.
> >>> >> >> >>
> >>> >> >> >>
> >>> >> >> >
> >>> >> >> >
> >>> >> >> > --
> >>> >> >> > Cheers,
> >>> >> >> > Guillaume Nodet
> >>> >> >> > ------------------------
> >>> >> >> > Blog: http://gnodet.blogspot.com/
> >>> >> >> >
> >>> >> >> >
> >>> >> >>
> >>> >> >> --
> >>> >> >> View this message in context:
> >>> >> >>
> >>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616748.html
> >>> >> >> Sent from the ServiceMix - User mailing list archive at
> >>> Nabble.com.
> >>> >> >>
> >>> >> >>
> >>> >> >
> >>> >> >
> >>> >> > --
> >>> >> > Cheers,
> >>> >> > Guillaume Nodet
> >>> >> > ------------------------
> >>> >> > Blog: http://gnodet.blogspot.com/
> >>> >> >
> >>> >> >
> >>> >>
> >>> >> --
> >>> >> View this message in context:
> >>> >>
> >>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14619757.html
> >>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>> >>
> >>> >>
> >>> >
> >>> >
> >>> > --
> >>> > Cheers,
> >>> > Guillaume Nodet
> >>> > ------------------------
> >>> > Blog: http://gnodet.blogspot.com/
> >>> >
> >>> >
> >>>
> >>> --
> >>> View this message in context:
> >>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14663812.html
> >>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>>
> >>>
> >>
> >>
> >> --
> >> Cheers,
> >> Guillaume Nodet
> >> ------------------------
> >> Blog: http://gnodet.blogspot.com/
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14665268.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: Consumer Can Send

Posted by martymusk <ma...@email.it>.
It's possible it can't send, because status exchange is done?

Martina


martymusk wrote:
> 
> Thank you very much...
> The exception is the same, I post it:
> 
> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E': InOnly[
>   id: ID:192.168.0.172-11754495367-2:0
>   status: Done
>   role: provider
>   endpoint: endpoint
>   in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> xmlns="http://www.w3.org/2005/08/addressing"
> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1"><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My Example
> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> Job</fullname><description/><fireTime>Mon Jan 07 13:46:56 CET
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> ]
> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus status =
> getStatus()
> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
> STATO
> INFO  - MessageExchangeImpl            - TERMINA handleSend
> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
> INFO  - DeliveryChannelImpl            - DOPO DI
> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> DEBUG - JMSFlow                        - Called Flow send
> DEBUG - ActiveMQSession                - Sending message:
> ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId
> = ID:martina-39867-1199709997721-3:0:1:1:7, originalDestination = null,
> originalTransactionId = null, producerId =
> ID:martina-39867-1199709997721-3:0:1:1, destination =
> queue://org.apache.servicemix.jms.{http://servicemix.org/wsnotification}NotificationBroker:Broker,
> transactionId = null, expiration = 0, timestamp = 1199710016807, arrival =
> 0, correlationId = null, replyTo = null, persistent = true, type = null,
> priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
> compressed = false, userID = null, content =
> org.apache.activemq.util.ByteSequence@5ac5f, marshalledProperties = null,
> dataStructure = null, redeliveryCounter = 0, size = 0, properties = null,
> readOnlyProperties = true, readOnlyBody = true, droppable = false}
> INFO  - DeliveryChannelImpl            - DOPO
> container.sendExchange(mirror);
> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> ERROR - JMSFlow                        - Caught an exception routing
> ExchangePacket: 
> javax.jbi.messaging.MessagingException: illegal call to send / sendSync
> 	at
> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(MessageExchangeImpl.java:581)
> 	at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:384)
> 	at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:444)
> 	at
> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java:249)
> 	at
> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(SubscriberComponent.java:204)
> 	at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:621)
> 	at
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
> 	at
> org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(JMSFlow.java:1)
> 	at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(JMSFlow.java:543)
> 	at
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
> 	at
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
> 	at java.lang.Thread.run(Thread.java:595)
> javax.jbi.messaging.MessagingException: illegal call to send / sendSync
> 	at
> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(MessageExchangeImpl.java:581)
> 	at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:384)
> 	at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:444)
> 	at
> org.apache.servicemix.components.util.PojoSupport.done(PojoSupport.java:193)
> 	at
> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(SubscriberComponent.java:198)
> 	at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:621)
> 	at
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
> 	at
> org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(JMSFlow.java:1)
> 	at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(JMSFlow.java:543)
> 	at
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
> 	at
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
> 	at java.lang.Thread.run(Thread.java:595)
> 
> What do I do wrong?
> Thanks in advance!
> 
> Martina
> 
> 
> gnodet wrote:
>> 
>> Just before calling fail(exchange, e), could you display the stack trace
>> of
>> the exception ?
>>    e.printStackTrace()
>> and send this error ?
>> This is the real error, but it seems to be hidden by fail() throwing
>> another
>> excepiton.
>> 
>> On Jan 7, 2008 12:32 PM, martymusk <ma...@email.it> wrote:
>> 
>>>
>>> Hy gnodet,
>>> thank you for your felpfulness.
>>> Thus, I've used InOnly exchange, but I've the same error.
>>> I post you my class and the error.
>>>
>>> package org.apache.servicemix.wsn;
>>>
>>>
>>> import java.io.StringWriter;
>>>
>>> import javax.jbi.JBIException;
>>> import javax.jbi.messaging.ExchangeStatus;
>>> import javax.jbi.messaging.MessageExchange;
>>> import javax.jbi.messaging.MessagingException;
>>> import javax.jbi.messaging.NormalizedMessage;
>>> import javax.xml.bind.JAXBContext;
>>> import javax.xml.transform.Source;
>>> import javax.xml.transform.TransformerException;
>>>
>>> import org.apache.commons.logging.Log;
>>> import org.apache.commons.logging.LogFactory;
>>> import org.apache.servicemix.MessageExchangeListener;
>>> import org.apache.servicemix.components.util.ComponentSupport;
>>> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
>>> import org.apache.servicemix.jbi.jaxp.StringSource;
>>> import org.apache.servicemix.wsn.client.AbstractWSAClient;
>>> import org.apache.servicemix.wsn.client.NotificationBroker;
>>> import org.oasis_open.docs.wsn.b_2.Subscribe;
>>> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
>>> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
>>> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
>>> import org.w3c.dom.Element;
>>>
>>>
>>>
>>>
>>>
>>>
>>>  public class SubscriberComponent extends ComponentSupport implements
>>> MessageExchangeListener {
>>>
>>>            private static final Log log =
>>> LogFactory.getLog(SubscriberComponent.class);
>>>
>>>            private NotificationBroker wsnBroker;
>>>            private String receiveTopic;
>>>            private boolean demand;
>>>            private String subscriptionEndpoint = "subscription";
>>>            private Subscribe subscription;
>>>
>>>            /**
>>>             * @return Returns the demand.
>>>             */
>>>            public boolean getDemand() {
>>>                return demand;
>>>            }
>>>
>>>            /**
>>>             * @param demand The demand to set.
>>>             */
>>>            public void setDemand(boolean demand) {
>>>                this.demand = demand;
>>>            }
>>>
>>>            /**
>>>             * @return Returns the topic.
>>>             */
>>>            public String getTopic() {
>>>                return receiveTopic;
>>>            }
>>>
>>>            /**
>>>             * @param topic The topic to set.
>>>             */
>>>            public void setTopic(String receiveTopic) {
>>>                this.receiveTopic = receiveTopic;
>>>            }
>>>
>>>            /**
>>>             * @return Returns the subscription.
>>>             */
>>>            public Subscribe getSubscription() {
>>>                return subscription;
>>>            }
>>>
>>>            /* (non-Javadoc)
>>>             * @see
>>> org.apache.servicemix.jbi.management.BaseLifeCycle#init
>>> ()
>>>             */
>>>            public void init() throws JBIException {
>>>                super.init();
>>>                getContext().activateEndpoint(getService(),
>>> subscriptionEndpoint);
>>>            }
>>>
>>>            /* (non-Javadoc)
>>>             * @see javax.jbi.management.LifeCycleMBean#start()
>>>             */
>>>            public void start() throws JBIException {
>>>                new Thread() {
>>>                    public void run() {
>>>                        try {
>>>                            wsnBroker = new
>>> NotificationBroker(getContext());
>>>                            String wsaAddress =
>>> getService().getNamespaceURI() +
>>> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>>>
>>> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
>>>                                                        receiveTopic,
>>>                                                        demand);
>>>                        } catch (Exception e) {
>>>                            log.error("Could not create wsn client", e);
>>>                        }
>>>                    }
>>>                }.start();
>>>            }
>>>
>>>
>>>            private SourceTransformer sourceTransformer = new
>>> SourceTransformer();
>>>
>>>            public SourceTransformer getSourceTransformer() {
>>>                        return sourceTransformer;
>>>                }
>>>
>>>                public void setSourceTransformer(SourceTransformer
>>> sourceTransformer) {
>>>                        this.sourceTransformer = sourceTransformer;
>>>                }
>>>
>>>            /* (non-Javadoc)
>>>             * @see javax.jbi.management.LifeCycleMBean#shutDown()
>>>             */
>>>            public void shutDown() throws JBIException {
>>>                super.shutDown();
>>>            }
>>>
>>>            /* (non-Javadoc)
>>>             * @see
>>> org.apache.servicemix.MessageExchangeListener#onMessageExchange(
>>> javax.jbi.messaging.MessageExchange)
>>>             */
>>>            public void onMessageExchange(MessageExchange exchange)
>>> throws
>>> MessagingException {
>>>
>>>                NormalizedMessage message = exchange.getMessage("in");
>>>                        if (message == null) {
>>>                                log.warn("Received null message from
>>> exchange: " + exchange);
>>>                        } else {
>>>                                log.info("Exchange: " + exchange + "
>>> received IN message: "
>>>                                                + message);
>>>                                try {
>>>                                        log.info("Body is: "
>>>                                                        +
>>> sourceTransformer.toString(message.getContent()));
>>>                                } catch (TransformerException e) {
>>>                                        log.error("Failed to turn message
>>> body into text: " + e, e);
>>>                                }
>>>                        }
>>>                        done(exchange);
>>>                        log.info("MESSAGGIO RICEVUTO");
>>>
>>>                  log.info("COPIO IL PACCHETTO");
>>>
>>>                        MessageExchange scambio =
>>> (MessageExchange)exchange;
>>>                        log.info("IL PACCHETTO COPIATO E': " +scambio);
>>>
>>>
>>>                if (exchange.getStatus() != ExchangeStatus.DONE) {
>>>                        log.info("RITORNA PERCHE' LO STATO E': "
>>> +exchange.getStatus());
>>>                    return;
>>>                }
>>>                // This is a notification from the WSN broker
>>>                if
>>> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
>>> {
>>>                    try {
>>>                        JAXBContext jaxbContext =
>>> JAXBContext.newInstance(Subscribe.class);
>>>                        Source src = exchange.getMessage
>>> ("in").getContent();
>>>                        Object input =
>>> jaxbContext.createUnmarshaller().unmarshal(src);
>>>                        if (input instanceof Subscribe) {
>>>                            subscription = (Subscribe) input;
>>>                            SubscribeResponse response = new
>>> SubscribeResponse();
>>>                            String wsaAddress =
>>> getService().getNamespaceURI() +
>>> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>>>
>>> response.setSubscriptionReference(AbstractWSAClient.createWSA
>>> (wsaAddress));
>>>                            StringWriter writer = new StringWriter();
>>>                            jaxbContext.createMarshaller
>>> ().marshal(response,
>>> writer);
>>>                            NormalizedMessage out =
>>> exchange.createMessage
>>> ();
>>>                            out.setContent(new
>>> StringSource(writer.toString
>>> ()));
>>>                            exchange.setMessage(out, "out");
>>>                            send(exchange);
>>>
>>>                        } else if (input instanceof Unsubscribe) {
>>>                            subscription = null;
>>>                            UnsubscribeResponse response = new
>>> UnsubscribeResponse();
>>>                            StringWriter writer = new StringWriter();
>>>                            jaxbContext.createMarshaller
>>> ().marshal(response,
>>> writer);
>>>                            NormalizedMessage out =
>>> exchange.createMessage
>>> ();
>>>                            out.setContent(new
>>> StringSource(writer.toString
>>> ()));
>>>                            exchange.setMessage(out, "out");
>>>                            send(exchange);
>>>
>>>
>>>                        } else {
>>>                            throw new Exception("Unkown request");
>>>                        }
>>>                    } catch (Exception e) {
>>>                        fail(exchange, e);
>>>                    }
>>>                // This is a notification to publish
>>>                }
>>>
>>>                  else {
>>>                    try {
>>>                        if (!demand || subscription != null) {
>>>                            Element elem = new
>>> SourceTransformer().toDOMElement(exchange.getMessage("in"));
>>>                            wsnBroker.notify(receiveTopic, elem);
>>>                            done(exchange);
>>>                        } else {
>>>                            log.info("Ingore notification as the
>>> publisher
>>> is no
>>> subscribers");
>>>                        }
>>>                    } catch (Exception e) {
>>>                        fail(exchange, e);
>>>                        }
>>>                }
>>>            }
>>>
>>>  }
>>>
>>>  ......
>>> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>>> DEBUG - JMSFlow                        - Called Flow send
>>> DEBUG - ActiveMQSession                - Sending message:
>>> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>>> messageId
>>> =
>>> ID:martina-39597-1199704995676-3:0:1:1:5, originalDestination = null,
>>> originalTransactionId = null, producerId =
>>> ID:martina-39597-1199704995676-3:0:1:1, destination =
>>> queue://org.apache.servicemix.jms.{
>>> http://servicemix.apache.org/demo}trace:endpoint<http://servicemix.apache.org/demo%7Dtrace:endpoint>
>>> ,
>>> transactionId = null, expiration = 0, timestamp = 1199705011173, arrival
>>> =
>>> 0, correlationId = null, replyTo = null, persistent = true, type = null,
>>> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
>>> null,
>>> compressed = false, userID = null, content =
>>> org.apache.activemq.util.ByteSequence@10a69f0, marshalledProperties =
>>> null,
>>> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
>>> null,
>>> readOnlyProperties = true, readOnlyBody = true, droppable = false}
>>> INFO  - SubscriberComponent            - Exchange: InOnly[
>>>  id: ID:192.168.0.172-11753fdefba-2:0
>>>  status: Active
>>>  role: provider
>>>  endpoint: endpoint
>>>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>>> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>>> xmlns="http://www.w3.org/2005/08/addressing"
>>> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>>> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>>> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>>> Example
>>> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>>> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>>>
>>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>>> ] received IN message:
>>>
>>> org.apache.servicemix.jbi.messaging.NormalizedMessageImpl@b125bd{properties
>>> :
>>> {}}
>>> INFO  - SubscriberComponent            - Body is: <?xml version="1.0"
>>> encoding="UTF-8"?><ns2:Notify xmlns:ns2="
>>> http://docs.oasis-open.org/wsn/b-2"
>>> xmlns="http://www.w3.org/2005/08/addressing"
>>> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>>> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>>> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>>> Example
>>> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>>> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>>>
>>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>>> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>>> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>>> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>>> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>>> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>>> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>>> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>>> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>>> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>>> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>>> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus status
>>> =
>>> getStatus()
>>> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
>>> STATO
>>> INFO  - MessageExchangeImpl            - TERMINA handleSend
>>> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
>>> INFO  - DeliveryChannelImpl            - DOPO DI
>>> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>>> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>>> DEBUG - JMSFlow                        - Called Flow send
>>> INFO  - DeliveryChannelImpl            - DOPO
>>> container.sendExchange(mirror);
>>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>>> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>>> DEBUG - ActiveMQSession                - Sending message:
>>> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>>> messageId
>>> =
>>> ID:martina-39597-1199704995676-3:0:1:1:6, originalDestination = null,
>>> originalTransactionId = null, producerId =
>>> ID:martina-39597-1199704995676-3:0:1:1, destination =
>>> queue://org.apache.servicemix.jms.wsn2, transactionId = null, expiration
>>> =
>>> 0, timestamp = 1199705011183, arrival = 0, correlationId = null, replyTo
>>> =
>>> null, persistent = true, type = null, priority = 4, groupID = null,
>>> groupSequence = 0, targetConsumerId = null, compressed = false, userID =
>>> null, content = org.apache.activemq.util.ByteSequence@c70f32,
>>> marshalledProperties = null, dataStructure = null, redeliveryCounter =
>>> 0,
>>> size = 0, properties = null, readOnlyProperties = true, readOnlyBody =
>>> true,
>>> droppable = false}
>>> INFO  - DeliveryChannelImpl            - DOPO
>>> container.sendExchange(mirror);
>>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>>> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>>> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>>> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>>> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
>>> InOnly[
>>>  id: ID:192.168.0.172-11753fdefba-2:0
>>>  status: Done
>>>  role: provider
>>>  endpoint: endpoint
>>>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>>> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>>> xmlns="http://www.w3.org/2005/08/addressing"
>>> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>>> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>>> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>>> Example
>>> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>>> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>>>
>>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>>> ]
>>> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>>> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>>> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
>>> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>>> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>>> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>>> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>>> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>>> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus status
>>> =
>>> getStatus()
>>> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
>>> STATO
>>> INFO  - MessageExchangeImpl            - TERMINA handleSend
>>> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
>>> INFO  - DeliveryChannelImpl            - DOPO DI
>>> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>>> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>>> DEBUG - JMSFlow                        - Called Flow send
>>> DEBUG - WSNSpringComponent             - Received exchange: status:
>>> Done,
>>> role: consumer
>>> DEBUG - WSNSpringComponent             - Retrieved correlation id: null
>>> DEBUG - ActiveMQSession                - Sending message:
>>> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>>> messageId
>>> =
>>> ID:martina-39597-1199704995676-3:0:1:1:7, originalDestination = null,
>>> originalTransactionId = null, producerId =
>>> ID:martina-39597-1199704995676-3:0:1:1, destination =
>>> queue://org.apache.servicemix.jms.{
>>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>>> ,
>>> transactionId = null, expiration = 0, timestamp = 1199705011188, arrival
>>> =
>>> 0, correlationId = null, replyTo = null, persistent = true, type = null,
>>> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
>>> null,
>>> compressed = false, userID = null, content =
>>> org.apache.activemq.util.ByteSequence@1c8f59c, marshalledProperties =
>>> null,
>>> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
>>> null,
>>> readOnlyProperties = true, readOnlyBody = true, droppable = false}
>>> INFO  - DeliveryChannelImpl            - DOPO
>>> container.sendExchange(mirror);
>>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>>> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>>> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>>> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>>> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>>> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>>> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>>> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>>> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>>> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>>> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>>> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>>> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>>> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>>> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>>> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>>> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>>> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>>> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>>> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>>> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>>> ERROR - JMSFlow                        - Caught an exception routing
>>> ExchangePacket:
>>> javax.jbi.messaging.MessagingException: illegal call to send / sendSync
>>>        at
>>> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>>> MessageExchangeImpl.java:581)
>>>        at
>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>>> DeliveryChannelImpl.java:384)
>>>        at
>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>>> DeliveryChannelImpl.java:444)
>>>        at
>>> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
>>> :249)
>>>        at
>>> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>>> SubscriberComponent.java:203)
>>>        at
>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>>> DeliveryChannelImpl.java:621)
>>>        at
>>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>>> AbstractFlow.java:174)
>>>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
>>> JMSFlow.java:1)
>>>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>>> JMSFlow.java:543)
>>>        at
>>>
>>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>>> (ThreadPoolExecutor.java:665)
>>>        at
>>>
>>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>>> (ThreadPoolExecutor.java:690)
>>>        at java.lang.Thread.run(Thread.java:595)
>>>
>>> Can you help me again?
>>> Thanks in advance!
>>>
>>> Martina
>>>
>>>
>>>
>>> gnodet wrote:
>>> >
>>> > You need to use an InOnly or RobustInOnly exchange, not an InOut
>>> exchange,
>>> > as notifications do not have any out messages.
>>> >
>>> > On Jan 4, 2008 5:16 PM, martymusk <ma...@email.it> wrote:
>>> >
>>> >>
>>> >> Thus , I've created a new class "SubscriberComponent" that is a copy
>>> of
>>> >> PublisherComponent. Trhough it instance2 receive exchange and try to
>>> send
>>> >> scambio (copy of exchange). When I run example the following error
>>> >> occurs...
>>> >>
>>> >> DEBUG - JMSFlow                        - Called Flow send
>>> >> DEBUG - ActiveMQSession                - Sending message:
>>> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>>> messageId
>>> >> =
>>> >> ID:martina-38529-1199462112612-3:0:1:1:6, originalDestination = null,
>>> >> originalTransactionId = null, producerId =
>>> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
>>> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
>>> expiration
>>> >> =
>>> >> 0, timestamp = 1199462153935, arrival = 0, correlationId = null,
>>> replyTo
>>> >> =
>>> >> null, persistent = true, type = null, priority = 4, groupID = null,
>>> >> groupSequence = 0, targetConsumerId = null, compressed = false,
>>> userID
>>> =
>>> >> null, content = org.apache.activemq.util.ByteSequence@b2175,
>>> >> marshalledProperties = null, dataStructure = null, redeliveryCounter
>>> =
>>> 0,
>>> >> size = 0, properties = null, readOnlyProperties = true, readOnlyBody
>>> =
>>> >> true,
>>> >> droppable = false}
>>> >> DEBUG - WSNSpringComponent             - Received exchange: status:
>>> >> Active,
>>> >> role: consumer
>>> >> DEBUG - WSNSpringComponent             - Retrieved correlation id:
>>> null
>>> >> INFO  - DeliveryChannelImpl            - DOPO
>>> >> container.sendExchange(mirror);
>>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>>> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>>> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>>> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>>> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
>>> InOut[
>>> >>  id: ID:192.168.0.172-1174583cdf9-2:0
>>> >>  status: Active
>>> >>  role: provider
>>> >>  endpoint: endpoint
>>> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>>> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>>> >> xmlns="http://www.w3.org/2005/08/addressing"
>>> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>>> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>>> >>
>>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>>> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>>> >> Example
>>> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>>> >> Job</fullname><description/><fireTime>Fri Jan 04 16:55:53 CET
>>> >>
>>> >>
>>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>>> >> ]
>>> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
>>> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>>> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>>> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>>> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>>> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>>> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
>>> status
>>> =
>>> >> getStatus()
>>> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
>>> >> STATO
>>> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
>>> >> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
>>> >> INFO  - DeliveryChannelImpl            - DOPO DI
>>> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>>> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>>> >> DEBUG - JMSFlow                        - Called Flow send
>>> >> DEBUG - ActiveMQSession                - Sending message:
>>> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>>> messageId
>>> >> =
>>> >> ID:martina-38529-1199462112612-3:0:1:1:7, originalDestination = null,
>>> >> originalTransactionId = null, producerId =
>>> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
>>> >> queue://org.apache.servicemix.jms.{
>>> >>
>>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>>> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>>> >> ,
>>> >> transactionId = null, expiration = 0, timestamp = 1199462153952,
>>> arrival
>>> >> =
>>> >> 0, correlationId = null, replyTo = null, persistent = true, type =
>>> null,
>>> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
>>> null,
>>> >> compressed = false, userID = null, content =
>>> >> org.apache.activemq.util.ByteSequence@779b3e, marshalledProperties =
>>> >> null,
>>> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
>>> null,
>>> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
>>> >> INFO  - DeliveryChannelImpl            - DOPO
>>> >> container.sendExchange(mirror);
>>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>>> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>>> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>>> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>>> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>>> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>>> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>>> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>>> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>>> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>>> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>>> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>>> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>>> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>>> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>>> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>>> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>>> >> ERROR - JMSFlow                        - Caught an exception routing
>>> >> ExchangePacket:
>>> >> javax.jbi.messaging.MessagingException: illegal call to send /
>>> sendSync
>>> >>        at
>>> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>>> >> MessageExchangeImpl.java:581)
>>> >>        at
>>> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>>> >> DeliveryChannelImpl.java:384)
>>> >>        at
>>> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>>> >> DeliveryChannelImpl.java:444)
>>> >>        at
>>> >>
>>> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
>>> >> :249)
>>> >>        at
>>> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>>> >> SubscriberComponent.java:203)
>>> >>        at
>>> >>
>>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>>> >> DeliveryChannelImpl.java:621)
>>> >>        at
>>> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>>> >> AbstractFlow.java:174)
>>> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
>>> >> JMSFlow.java:1)
>>> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>>> >> JMSFlow.java:543)
>>> >>        at
>>> >>
>>> >>
>>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>>> >> (ThreadPoolExecutor.java:665)
>>> >>        at
>>> >>
>>> >>
>>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>>> >> (ThreadPoolExecutor.java:690)
>>> >>        at java.lang.Thread.run(Thread.java:595)
>>> >>
>>> >> I do wrong again?
>>> >>
>>> >> Thank you!!!
>>> >> Martina
>>> >>
>>> >>
>>> >> gnodet wrote:
>>> >> >
>>> >> > You should have a look at the existing code:
>>> >> >
>>> >> >
>>> >>
>>> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/spring/PublisherComponent.java?r=602828
>>> >> >
>>> >> > Note that the publisher component actually use the client api (line
>>> >> 172).
>>> >> > For details on thow the client api works (which is how to send a
>>> JBI
>>> >> > exchange to the WSN broker), see:
>>> >> >
>>> >> >
>>> >>
>>> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/client/NotificationBroker.java?r=602828#l89
>>> >> >
>>> >> > I would advise you to start from the publisher component, copy it
>>> and
>>> >> use
>>> >> > it
>>> >> > instead of your TraceComponent.
>>> >> > Each time it receives a JBI exchange, it will publish it through
>>> the
>>> >> > WSNotification broker.
>>> >> >
>>> >> > Also look at the various resources on the web site that may help
>>> you:
>>> >> >   http://servicemix.apache.org/servicemix-wsn2005.html
>>> >> >   http://servicemix.apache.org/example-scenario.html
>>> >> >
>>> >> >
>>> >> >
>>> >> > On Jan 4, 2008 2:58 PM, martymusk <ma...@email.it> wrote:
>>> >> >
>>> >> >>
>>> >> >> Hy gnodet and thank you very much for your helpfulness,
>>> >> >> but I don't understand exactly what I must to do.
>>> >> >>
>>> >> >> How can I send JBI exchange to the WSN broker directly?
>>> >> >> How can I use WSN client api.
>>> >> >>
>>> >> >> I'm working for a thesis at University of Naples.
>>> >> >> My purpose is to study WSN performance.
>>> >> >> I've found your WSN implementation very useful for me, but to
>>> study
>>> >> >> performance, I need exchange was send back.
>>> >> >> It is more than a mounth I'm triyng to do this.
>>> >> >>
>>> >> >> I would be very grateful if you can help me. Otherwise, there are
>>> no
>>> >> >> problems, I'll keep on study over and over again, hoping I be able
>>> to
>>> >> >> achieve my purpose.
>>> >> >>
>>> >> >> Thank you very much.
>>> >> >> Martina
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> gnodet wrote:
>>> >> >> >
>>> >> >> > I thought I pointed you to the right direction.
>>> >> >> > Do not use the PublisherComponent that way: either use it as it
>>> is
>>> >> >> > intended
>>> >> >> > (deploy it as a component onto the lightweight container) or use
>>> the
>>> >> >> WSN
>>> >> >> > client api:
>>> >> >> >    wsn.notify(topic, msg)
>>> >> >> >
>>> >> >> > I'm not sure what you are trying to achieve with your
>>> >> TraceComponent.
>>> >> >>  It
>>> >> >> > sounds like you want to reimplement the PublisherComponent.  If
>>> so,
>>> >> you
>>> >> >> > should have a look at how it is implemented and patch it.
>>> >> >> >
>>> >> >> > Also note that both PublisherComponent and the WSN client api
>>> are
>>> >> just
>>> >> >> > sugar, you can send a JBI exchange to the WSN broker directly if
>>> you
>>> >> >> want.
>>> >> >> >
>>> >> >> > On Jan 4, 2008 2:13 PM, martymusk <ma...@email.it> wrote:
>>> >> >> >
>>> >> >> >>
>>> >> >> >> My problem is always the same!
>>> >> >> >> In wsn-example, after Consumer received an exchange, I'd like
>>> it
>>> >> send
>>> >> >> >> copy
>>> >> >> >> of it. But it doesn't happen. :-(
>>> >> >> >> I've modified TraceComponent class in the following way, but it
>>> >> >> doesn't
>>> >> >> >> work
>>> >> >> >> fine:
>>> >> >> >>
>>> >> >> >>
>>> >> >> >> package org.apache.servicemix.wsn;
>>> >> >> >>
>>> >> >> >> import java.io.StringWriter;
>>> >> >> >>
>>> >> >> >> import javax.jbi.JBIException;
>>> >> >> >> import javax.jbi.messaging.ExchangeStatus;
>>> >> >> >> import javax.jbi.messaging.MessageExchange;
>>> >> >> >> import javax.jbi.messaging.MessagingException;
>>> >> >> >> import javax.jbi.messaging.NormalizedMessage;
>>> >> >> >> import javax.xml.bind.JAXBContext;
>>> >> >> >> import javax.xml.transform.Source;
>>> >> >> >> import javax.xml.transform.TransformerException;
>>> >> >> >> //import javax.jbi.messaging.InOut;
>>> >> >> >>
>>> >> >> >> import org.apache.servicemix.jbi.messaging.MessageExchangeImpl;
>>> >> >> >> import org.apache.servicemix.jbi.messaging.InOutImpl;
>>> >> >> >> import org.apache.commons.logging.Log;
>>> >> >> >> import org.apache.commons.logging.LogFactory;
>>> >> >> >> import org.apache.servicemix.MessageExchangeListener;
>>> >> >> >> import org.apache.servicemix.components.util.ComponentSupport;
>>> >> >> >> import org.apache.servicemix.wsn.spring.PublisherComponent;
>>> >> >> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
>>> >> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
>>> >> >> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
>>> >> >> >> import org.apache.servicemix.wsn.client.NotificationBroker;
>>> >> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
>>> >> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
>>> >> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
>>> >> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
>>> >> >> >> import org.w3c.dom.Element;
>>> >> >> >>
>>> >> >> >>
>>> >> >> >> public class TraceComponent extends ComponentSupport implements
>>> >> >> >>                MessageExchangeListener {
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>        private Log log =
>>> LogFactory.getLog(TraceComponent.class);
>>> >> >> >>
>>> >> >> >>        private SourceTransformer sourceTransformer = new
>>> >> >> >> SourceTransformer();
>>> >> >> >>
>>> >> >> >>        public Log getLog() {
>>> >> >> >>                return log;
>>> >> >> >>        }
>>> >> >> >>
>>> >> >> >>        public void setLog(Log log) {
>>> >> >> >>                this.log = log;
>>> >> >> >>        }
>>> >> >> >>
>>> >> >> >>        public SourceTransformer getSourceTransformer() {
>>> >> >> >>                return sourceTransformer;
>>> >> >> >>        }
>>> >> >> >>
>>> >> >> >>        public void setSourceTransformer(SourceTransformer
>>> >> >> >> sourceTransformer) {
>>> >> >> >>                this.sourceTransformer = sourceTransformer;
>>> >> >> >>        }
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>        //AGGIUNGO CODICE
>>> >> >> >>
>>> >> >> >>        PublisherComponent publisher = new PublisherComponent();
>>> >> >> >>          private String subscriptionEndpoint = "subscription";
>>> >> >> >>          private NotificationBroker wsnBroker;
>>> >> >> >>          private String topic;
>>> >> >> >>          private String msg;
>>> >> >> >>          private boolean demand;
>>> >> >> >>          private Subscribe subscription;
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>          public String getTopic() {
>>> >> >> >>                return topic;
>>> >> >> >>            }
>>> >> >> >>
>>> >> >> >>            /**
>>> >> >> >>             * @param topic The topic to set.
>>> >> >> >>             */
>>> >> >> >>            public void setTopic(String topic) {
>>> >> >> >>               this.topic = topic;
>>> >> >> >>            }
>>> >> >> >>
>>> >> >> >>         public void init() throws JBIException {
>>> >> >> >>                super.init();
>>> >> >> >>                getContext().activateEndpoint(getService(),
>>> >> >> >> subscriptionEndpoint);
>>> >> >> >>                 log.info("METODO INIT");
>>> >> >> >>                // publisher.init();
>>> >> >> >>
>>> >> >> >>                 publisher.setTopic(topic);
>>> >> >> >>            }
>>> >> >> >>
>>> >> >> >>            /* (non-Javadoc)
>>> >> >> >>             * @see javax.jbi.management.LifeCycleMBean#start()
>>> >> >> >>             */
>>> >> >> >>            public void start() throws JBIException {
>>> >> >> >>
>>> >> >> >>                log.info("METODO START");
>>> >> >> >>                //publisher.start();
>>> >> >> >>                new Thread() {
>>> >> >> >>                  public void run() {
>>> >> >> >>                       try {
>>> >> >> >>                           wsnBroker = new
>>> >> >> >> NotificationBroker(getContext());
>>> >> >> >>
>>> >> >> >>                           String wsaAddress =
>>> >> >> >> getService().getNamespaceURI() + "/"
>>> >> >> >> + getService().getLocalPart() + "/" + subscriptionEndpoint;
>>> >> >> >>
>>> >> >> >>
>>> >> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
>>> >> >> >>                                                       topic,
>>> >> >> >>                                                        demand);
>>> >> >> >>                        } catch (Exception e) {
>>> >> >> >>                            log.error("Could not create wsn
>>> client",
>>> >> >> e);
>>> >> >> >>                        }
>>> >> >> >>                    }
>>> >> >> >>                }.start();
>>> >> >> >>            }
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>            public void shutDown() throws JBIException {
>>> >> >> >>                log.info("METODO SHUTDOWN");
>>> >> >> >>            //  publisher.shutDown();
>>> >> >> >>               super.shutDown();
>>> >> >> >>            }
>>> >> >> >>
>>> >> >> >>            //FINE CODICE AGGIUNTO
>>> >> >> >>
>>> >> >> >>        public void onMessageExchange(MessageExchange exchange)
>>> >> >> >>                        throws MessagingException {
>>> >> >> >>                // lets dump the incoming message
>>> >> >> >>                NormalizedMessage message = exchange.getMessage
>>> >> ("in");
>>> >> >> >>                if (message == null) {
>>> >> >> >>                        log.warn("Received null message from
>>> >> exchange:
>>> >> >> "
>>> >> >> +
>>> >> >> >> exchange);
>>> >> >> >>                } else {
>>> >> >> >>                        log.info("Exchange: " + exchange + "
>>> >> received
>>> >> >> IN
>>> >> >> >> message: "
>>> >> >> >>                                        + message);
>>> >> >> >>                        try {
>>> >> >> >>                                log.info("Body is: "
>>> >> >> >>                                                +
>>> >> >> >> sourceTransformer.toString(message.getContent()));
>>> >> >> >>                        } catch (TransformerException e) {
>>> >> >> >>                                log.error("Failed to turn
>>> message
>>> >> body
>>> >> >> >> into
>>> >> >> >> text: " + e, e);
>>> >> >> >>                        }
>>> >> >> >>                }
>>> >> >> >>                done(exchange);
>>> >> >> >>                log.info("MESSAGGIO RICEVUTO");
>>> >> >> >>
>>> >> >> >>                log.info("COPIO IL PACCHETTO");
>>> >> >> >>
>>> >> >> >>                MessageExchange scambio =
>>> (MessageExchange)exchange;
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>                log.info("INVIO");
>>> >> >> >>
>>> >> >> >>          try{
>>> >> >> >>
>>> >> >> >>                log.info("FASE INVIO");
>>> >> >> >>                //publisher.onMessageExchange(scambio);
>>> >> >> >>
>>> >> >> >>                //AGGIUNGO onMessageExchange
>>> >> >> >>
>>> >> >> >>                if (exchange.getStatus() !=
>>> ExchangeStatus.ACTIVE)
>>> {
>>> >> >> >>                    return;
>>> >> >> >>                }
>>> >> >> >>                // This is a notification from the WSN broker
>>> >> >> >>                if
>>> >> >> >>
>>> >> >>
>>> >>
>>> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
>>> >> >> {
>>> >> >> >>                    try {
>>> >> >> >>                        JAXBContext jaxbContext =
>>> >> >> >> JAXBContext.newInstance(Subscribe.class);
>>> >> >> >>                        Source src = exchange.getMessage
>>> >> >> >> ("in").getContent();
>>> >> >> >>                        Object input =
>>> >> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
>>> >> >> >>                        if (input instanceof Subscribe) {
>>> >> >> >>                            subscription = (Subscribe) input;
>>> >> >> >>                            SubscribeResponse response = new
>>> >> >> >> SubscribeResponse();
>>> >> >> >>                            String wsaAddress =
>>> >> >> >> getService().getNamespaceURI() +
>>> >> >> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>>> >> >> >>
>>> >> >> >> response.setSubscriptionReference(AbstractWSAClient.createWSA
>>> >> >> >> (wsaAddress));
>>> >> >> >>                            StringWriter writer = new
>>> >> StringWriter();
>>> >> >> >>                            jaxbContext.createMarshaller
>>> >> >> >> ().marshal(response,
>>> >> >> >> writer);
>>> >> >> >>                            NormalizedMessage out =
>>> >> >> exchange.createMessage
>>> >> >> >> ();
>>> >> >> >>                            out.setContent(new
>>> >> >> >> StringSource(writer.toString
>>> >> >> >> ()));
>>> >> >> >>                            exchange.setMessage(out, "out");
>>> >> >> >>                            send(exchange);
>>> >> >> >>
>>> >> >> >>                        } else if (input instanceof Unsubscribe)
>>> {
>>> >> >> >>                            subscription = null;
>>> >> >> >>                            UnsubscribeResponse response = new
>>> >> >> >> UnsubscribeResponse();
>>> >> >> >>                            StringWriter writer = new
>>> >> StringWriter();
>>> >> >> >>                            jaxbContext.createMarshaller
>>> >> >> >> ().marshal(response,
>>> >> >> >> writer);
>>> >> >> >>                            NormalizedMessage out =
>>> >> >> exchange.createMessage
>>> >> >> >> ();
>>> >> >> >>                            out.setContent(new
>>> >> >> >> StringSource(writer.toString
>>> >> >> >> ()));
>>> >> >> >>                            exchange.setMessage(out, "out");
>>> >> >> >>                            send(exchange);
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>                        } else {
>>> >> >> >>                            throw new Exception("Unkown
>>> request");
>>> >> >> >>                        }
>>> >> >> >>                    } catch (Exception e) {
>>> >> >> >>                        fail(exchange, e);
>>> >> >> >>                    }
>>> >> >> >>                // This is a notification to publish
>>> >> >> >>                }
>>> >> >> >>
>>> >> >> >>                  else {
>>> >> >> >>                    try {
>>> >> >> >>
>>> >> >> >>                    log.info("SALTA");
>>> >> >> >>                        if (!demand || subscription != null) {
>>> >> >> >>                                log.info("ENTRO NELL'IF");
>>> >> >> >>                           // Element elem = new
>>> >> >> >> SourceTransformer().toDOMElement(exchange.getMessage("in"));
>>> >> >> >>                            log.info("PRIMA DI WSNBROKER");
>>> >> >> >>                            wsnBroker.notify(topic, msg);
>>> >> >> >>                            log.info("PRIMA DI DONE");
>>> >> >> >>                            getDeliveryChannel().send(exchange);
>>> >> >> >>                            log.info("DOPO DI DONE");
>>> >> >> >>                        } else {
>>> >> >> >>                            log.info("Ingore notification as the
>>> >> >> publisher
>>> >> >> >> is no
>>> >> >> >> subscribers");
>>> >> >> >>                        }
>>> >> >> >>                    } catch (Exception e) {
>>> >> >> >>                        fail(exchange, e);
>>> >> >> >>                        }
>>> >> >> >>
>>> >> >> >>                log.debug("IL PACCHETTO INVIATO E': " +
>>> scambio);
>>> >> >> >>
>>> >> >> >>                  }
>>> >> >> >>                //FINE onMessageExchange
>>> >> >> >>
>>> >> >> >>           } catch(JBIException e){
>>> >> >> >>                  log.error("ECCEZIONE GENERATA!");
>>> >> >> >>          }
>>> >> >> >>
>>> >> >> >>      log.info("INVIATO");
>>> >> >> >> }
>>> >> >> >> }
>>> >> >> >>
>>> >> >> >>
>>> >> >> >> Help me if you can.
>>> >> >> >> Thank you very much for your helpfulness...
>>> >> >> >>
>>> >> >> >> Martina
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>
>>> >> >> >>
>>> >> >> >> gnodet wrote:
>>> >> >> >> >
>>> >> >> >> > You should not have to deal nor see the internal state of the
>>> >> >> exchange.
>>> >> >> >> > If guess you have an exception when trying to send an
>>> exchange,
>>> >> but
>>> >> >> >> this
>>> >> >> >> > means that there is a problem in your code.  You should post
>>> a
>>> >> >> snippet
>>> >> >> >> of
>>> >> >> >> > your code that is failing so that we can help you.
>>> >> >> >> >
>>> >> >> >> > On Jan 4, 2008 12:22 PM, martymusk <ma...@email.it>
>>> wrote:
>>> >> >> >> >
>>> >> >> >> >>
>>> >> >> >> >> Hy,
>>> >> >> >> >> I've a question...
>>> >> >> >> >> can I set anywhere Consumer to CAN_SEND?
>>> >> >> >> >>
>>> >> >> >> >> I hope you can help me.
>>> >> >> >> >> Thank you in advance.
>>> >> >> >> >>
>>> >> >> >> >> Martina
>>> >> >> >> >> --
>>> >> >> >> >> View this message in context:
>>> >> >> >> >>
>>> >> >>
>>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
>>> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
>>> >> Nabble.com.
>>> >> >> >> >>
>>> >> >> >> >>
>>> >> >> >> >
>>> >> >> >> >
>>> >> >> >> > --
>>> >> >> >> > Cheers,
>>> >> >> >> > Guillaume Nodet
>>> >> >> >> > ------------------------
>>> >> >> >> > Blog: http://gnodet.blogspot.com/
>>> >> >> >> >
>>> >> >> >> >
>>> >> >> >>
>>> >> >> >> --
>>> >> >> >> View this message in context:
>>> >> >> >>
>>> >>
>>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616107.html
>>> >> >> >> Sent from the ServiceMix - User mailing list archive at
>>> Nabble.com.
>>> >> >> >>
>>> >> >> >>
>>> >> >> >
>>> >> >> >
>>> >> >> > --
>>> >> >> > Cheers,
>>> >> >> > Guillaume Nodet
>>> >> >> > ------------------------
>>> >> >> > Blog: http://gnodet.blogspot.com/
>>> >> >> >
>>> >> >> >
>>> >> >>
>>> >> >> --
>>> >> >> View this message in context:
>>> >> >>
>>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616748.html
>>> >> >> Sent from the ServiceMix - User mailing list archive at
>>> Nabble.com.
>>> >> >>
>>> >> >>
>>> >> >
>>> >> >
>>> >> > --
>>> >> > Cheers,
>>> >> > Guillaume Nodet
>>> >> > ------------------------
>>> >> > Blog: http://gnodet.blogspot.com/
>>> >> >
>>> >> >
>>> >>
>>> >> --
>>> >> View this message in context:
>>> >>
>>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14619757.html
>>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>> >>
>>> >>
>>> >
>>> >
>>> > --
>>> > Cheers,
>>> > Guillaume Nodet
>>> > ------------------------
>>> > Blog: http://gnodet.blogspot.com/
>>> >
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14663812.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>
>>>
>> 
>> 
>> -- 
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14665268.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Consumer Can Send

Posted by martymusk <ma...@email.it>.
Hy gnodet,
thank you very much!!!

I've a problem...
Why example run fine with Eclipse and it doesn't run from linux shell?
They doesn't use the same jar files?

Please, help me if you can.

Thanks in advance!

Martina









gnodet wrote:
> 
> If you are talking about the WS-Notification example from the ServiceMix
> distribution, it will certainly works.  You just need to make sure
> multicast
> is enabled on your network between your nodes, else they won't discover
> each
> other.   Note that multicast is not a requirement and you can configure
> another discovery mechanism if you need, but this is how the example is
> configured.
> 
> On Jan 8, 2008 5:02 PM, martymusk <ma...@email.it> wrote:
> 
>>
>> Hy gnodet,
>> thank you very much.
>> It run fine!!! :)
>> Now I'd like to run this example on three different node.
>> Do you think it's possible?
>> I'd like to run instance1 on one node, instance2 on another node and
>> instance3 on another again...
>> Can you help me again, please?
>>
>> Thank you in advance,
>>
>> Martina
>>
>>
>>
>> gnodet wrote:
>> >
>> > You need to understand how exchanges are sent between components.
>> > For a simple InOnly exchange, it will be the following:
>> >    * consumer create the exchange and call send
>> >    * provider receives the exchange (possibly in onMessageExchange)
>> >    * provide set the done status and call send
>> >    * consumer receives the exchange in a DONE status
>> >
>> > In your case, the PublisherComponent acts both as a consumer and a
>> > provider,
>> > because it receives an exchange and send a copy to the broker, so the
>> > onMessageExchange will be called multiple times:
>> >    * first when it receives the first exchange and acts as the provider
>> > (it
>> > creates a new exchange and send it by using the WSNotification client
>> api)
>> >    * then when the exchange comes back with a DONE status
>> >
>> > The log you pasted below is fine but is the second call to the method
>> (you
>> > can see the DONE status and even the content of the exchange that has
>> been
>> > previously sent).  Check earlier in your log and you will find what you
>> > need.
>> >
>> > On Jan 7, 2008 2:39 PM, martymusk <ma...@email.it> wrote:
>> >
>> >>
>> >> I've tried with original code, and it returns because status is DONE.
>> >> I post output obtained with original code:
>> >>
>> >> DEBUG - WSNSpringComponent             - Received exchange: status:
>> Done,
>> >> role: consumer
>> >> DEBUG - WSNSpringComponent             - Retrieved correlation id:
>> null
>> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> container.sendExchange(mirror);
>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
>> InOnly[
>> >>  id: ID:192.168.0.172-1175476963a-2:0
>> >>  status: Done
>> >>  role: provider
>> >>  endpoint: endpoint
>> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> >> Example
>> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> >> Job</fullname><description/><fireTime>Mon Jan 07 14:35:12 CET
>> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> ]
>> >> INFO  - SubscriberComponent            - RETURNS BECAUSE STATUS IS:
>> Done
>> >>
>> >> So I've tried to modify ACTIVE with DONE, hoping it carry on, but it
>> >> fails
>> >> with error I've posted previously.
>> >>
>> >> I don't understand what I do wrong!
>> >> It's more than a mounth I'm trying to return back exchange. :-(
>> >>
>> >> Thank you very much for help you give me!
>> >>
>> >> Martina
>> >>
>> >>
>> >>
>> >> gnodet wrote:
>> >> >
>> >> > Have you tried with the original code before modifying the class
>> from
>> >> > ServiceMix ?
>> >> > The first lines of the SubscriberComponent#onMessageExchange are
>> >> >
>> >> >  if (exchange.getStatus() != ExchangeStatus.ACTIVE) {
>> >> >      return;
>> >> >  }
>> >> >
>> >> > This is because you have to ignore exchanges in an Error / Done
>> status.
>> >> > From the code you pasted, it seems you removed those lines and
>> instead
>> >> do
>> >> > some copy work and call done() which will fail for exchanges that
>> are
>> >> not
>> >> > active.
>> >> >
>> >> > You can add debugging statements if you need (debug remoting works
>> fine
>> >> > too), but please try with the original code first.
>> >> >
>> >> > On Jan 7, 2008 1:52 PM, martymusk <ma...@email.it> wrote:
>> >> >
>> >> >>
>> >> >> Thank you very much...
>> >> >> The exception is the same, I post it:
>> >> >>
>> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> >> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> >> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
>> >> InOnly[
>> >> >>  id: ID:192.168.0.172-11754495367-2:0
>> >> >>  status: Done
>> >> >>  role: provider
>> >> >>  endpoint: endpoint
>> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >> >>
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> >> >> Example
>> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> >> >> Job</fullname><description/><fireTime>Mon Jan 07 13:46:56 CET
>> >> >>
>> >> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> >> ]
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
>> >> status
>> >> =
>> >> >> getStatus()
>> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA
>> LO
>> >> >> STATO
>> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> me.handleSend(sync)
>> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> >> messageId
>> >> >> =
>> >> >> ID:martina-39867-1199709997721-3:0:1:1:7, originalDestination =
>> null,
>> >> >> originalTransactionId = null, producerId =
>> >> >> ID:martina-39867-1199709997721-3:0:1:1, destination =
>> >> >> queue://org.apache.servicemix.jms.{
>> >> >>
>> >>
>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> >> ,
>> >> >> transactionId = null, expiration = 0, timestamp = 1199710016807,
>> >> arrival
>> >> >> =
>> >> >> 0, correlationId = null, replyTo = null, persistent = true, type =
>> >> null,
>> >> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
>> >> null,
>> >> >> compressed = false, userID = null, content =
>> >> >> org.apache.activemq.util.ByteSequence@5ac5f, marshalledProperties =
>> >> null,
>> >> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
>> >> null,
>> >> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
>> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> container.sendExchange(mirror);
>> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> ERROR - JMSFlow                        - Caught an exception
>> routing
>> >> >> ExchangePacket:
>> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
>> >> sendSync
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> >> >> MessageExchangeImpl.java:581)
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>> >> >> DeliveryChannelImpl.java:384)
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> >> >> DeliveryChannelImpl.java:444)
>> >> >>        at
>> >> >>
>> >>
>> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
>> >> >> :249)
>> >> >>        at
>> >> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> >> >> SubscriberComponent.java:204)
>> >> >>        at
>> >> >>
>> >>
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> >> >> DeliveryChannelImpl.java:621)
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> >> >> AbstractFlow.java:174)
>> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
>> >> >> JMSFlow.java:1)
>> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>> >> >> JMSFlow.java:543)
>> >> >>        at
>> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> >> >> (ThreadPoolExecutor.java:665)
>> >> >>        at
>> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> >> >> (ThreadPoolExecutor.java:690)
>> >> >>        at java.lang.Thread.run(Thread.java:595)
>> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
>> >> sendSync
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> >> >> MessageExchangeImpl.java:581)
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>> >> >> DeliveryChannelImpl.java:384)
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> >> >> DeliveryChannelImpl.java:444)
>> >> >>        at
>> >> >>
>> >>
>> org.apache.servicemix.components.util.PojoSupport.done(PojoSupport.java
>> >> >> :193)
>> >> >>        at
>> >> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> >> >> SubscriberComponent.java:198)
>> >> >>        at
>> >> >>
>> >>
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> >> >> DeliveryChannelImpl.java:621)
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> >> >> AbstractFlow.java:174)
>> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
>> >> >> JMSFlow.java:1)
>> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>> >> >> JMSFlow.java:543)
>> >> >>        at
>> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> >> >> (ThreadPoolExecutor.java:665)
>> >> >>        at
>> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> >> >> (ThreadPoolExecutor.java:690)
>> >> >>        at java.lang.Thread.run(Thread.java:595)
>> >> >>
>> >> >> What do I do wrong?
>> >> >> Thanks in advance!
>> >> >>
>> >> >> Martina
>> >> >>
>> >> >>
>> >> >> gnodet wrote:
>> >> >> >
>> >> >> > Just before calling fail(exchange, e), could you display the
>> stack
>> >> >> trace
>> >> >> > of
>> >> >> > the exception ?
>> >> >> >    e.printStackTrace()
>> >> >> > and send this error ?
>> >> >> > This is the real error, but it seems to be hidden by fail()
>> throwing
>> >> >> > another
>> >> >> > excepiton.
>> >> >> >
>> >> >> > On Jan 7, 2008 12:32 PM, martymusk <ma...@email.it> wrote:
>> >> >> >
>> >> >> >>
>> >> >> >> Hy gnodet,
>> >> >> >> thank you for your felpfulness.
>> >> >> >> Thus, I've used InOnly exchange, but I've the same error.
>> >> >> >> I post you my class and the error.
>> >> >> >>
>> >> >> >> package org.apache.servicemix.wsn;
>> >> >> >>
>> >> >> >>
>> >> >> >> import java.io.StringWriter;
>> >> >> >>
>> >> >> >> import javax.jbi.JBIException;
>> >> >> >> import javax.jbi.messaging.ExchangeStatus;
>> >> >> >> import javax.jbi.messaging.MessageExchange;
>> >> >> >> import javax.jbi.messaging.MessagingException;
>> >> >> >> import javax.jbi.messaging.NormalizedMessage;
>> >> >> >> import javax.xml.bind.JAXBContext;
>> >> >> >> import javax.xml.transform.Source;
>> >> >> >> import javax.xml.transform.TransformerException;
>> >> >> >>
>> >> >> >> import org.apache.commons.logging.Log;
>> >> >> >> import org.apache.commons.logging.LogFactory;
>> >> >> >> import org.apache.servicemix.MessageExchangeListener;
>> >> >> >> import org.apache.servicemix.components.util.ComponentSupport;
>> >> >> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
>> >> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
>> >> >> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
>> >> >> >> import org.apache.servicemix.wsn.client.NotificationBroker;
>> >> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
>> >> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
>> >> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
>> >> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
>> >> >> >> import org.w3c.dom.Element;
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>  public class SubscriberComponent extends ComponentSupport
>> >> implements
>> >> >> >> MessageExchangeListener {
>> >> >> >>
>> >> >> >>            private static final Log log =
>> >> >> >> LogFactory.getLog(SubscriberComponent.class);
>> >> >> >>
>> >> >> >>            private NotificationBroker wsnBroker;
>> >> >> >>            private String receiveTopic;
>> >> >> >>            private boolean demand;
>> >> >> >>            private String subscriptionEndpoint = "subscription";
>> >> >> >>            private Subscribe subscription;
>> >> >> >>
>> >> >> >>            /**
>> >> >> >>             * @return Returns the demand.
>> >> >> >>             */
>> >> >> >>            public boolean getDemand() {
>> >> >> >>                return demand;
>> >> >> >>            }
>> >> >> >>
>> >> >> >>            /**
>> >> >> >>             * @param demand The demand to set.
>> >> >> >>             */
>> >> >> >>            public void setDemand(boolean demand) {
>> >> >> >>                this.demand = demand;
>> >> >> >>            }
>> >> >> >>
>> >> >> >>            /**
>> >> >> >>             * @return Returns the topic.
>> >> >> >>             */
>> >> >> >>            public String getTopic() {
>> >> >> >>                return receiveTopic;
>> >> >> >>            }
>> >> >> >>
>> >> >> >>            /**
>> >> >> >>             * @param topic The topic to set.
>> >> >> >>             */
>> >> >> >>            public void setTopic(String receiveTopic) {
>> >> >> >>                this.receiveTopic = receiveTopic;
>> >> >> >>            }
>> >> >> >>
>> >> >> >>            /**
>> >> >> >>             * @return Returns the subscription.
>> >> >> >>             */
>> >> >> >>            public Subscribe getSubscription() {
>> >> >> >>                return subscription;
>> >> >> >>            }
>> >> >> >>
>> >> >> >>            /* (non-Javadoc)
>> >> >> >>             * @see
>> >> >> >> org.apache.servicemix.jbi.management.BaseLifeCycle#init
>> >> >> >> ()
>> >> >> >>             */
>> >> >> >>            public void init() throws JBIException {
>> >> >> >>                super.init();
>> >> >> >>                getContext().activateEndpoint(getService(),
>> >> >> >> subscriptionEndpoint);
>> >> >> >>            }
>> >> >> >>
>> >> >> >>            /* (non-Javadoc)
>> >> >> >>             * @see javax.jbi.management.LifeCycleMBean#start()
>> >> >> >>             */
>> >> >> >>            public void start() throws JBIException {
>> >> >> >>                new Thread() {
>> >> >> >>                    public void run() {
>> >> >> >>                        try {
>> >> >> >>                            wsnBroker = new
>> >> >> >> NotificationBroker(getContext());
>> >> >> >>                            String wsaAddress =
>> >> >> >> getService().getNamespaceURI() +
>> >> >> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>> >> >> >>
>> >> >> >>
>> >> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
>> >> >> >>
>> >> receiveTopic,
>> >> >> >>                                                        demand);
>> >> >> >>                        } catch (Exception e) {
>> >> >> >>                            log.error("Could not create wsn
>> client",
>> >> >> e);
>> >> >> >>                        }
>> >> >> >>                    }
>> >> >> >>                }.start();
>> >> >> >>            }
>> >> >> >>
>> >> >> >>
>> >> >> >>            private SourceTransformer sourceTransformer = new
>> >> >> >> SourceTransformer();
>> >> >> >>
>> >> >> >>            public SourceTransformer getSourceTransformer() {
>> >> >> >>                        return sourceTransformer;
>> >> >> >>                }
>> >> >> >>
>> >> >> >>                public void
>> setSourceTransformer(SourceTransformer
>> >> >> >> sourceTransformer) {
>> >> >> >>                        this.sourceTransformer =
>> sourceTransformer;
>> >> >> >>                }
>> >> >> >>
>> >> >> >>            /* (non-Javadoc)
>> >> >> >>             * @see
>> javax.jbi.management.LifeCycleMBean#shutDown()
>> >> >> >>             */
>> >> >> >>            public void shutDown() throws JBIException {
>> >> >> >>                super.shutDown();
>> >> >> >>            }
>> >> >> >>
>> >> >> >>            /* (non-Javadoc)
>> >> >> >>             * @see
>> >> >> >> org.apache.servicemix.MessageExchangeListener#onMessageExchange(
>> >> >> >> javax.jbi.messaging.MessageExchange)
>> >> >> >>             */
>> >> >> >>            public void onMessageExchange(MessageExchange
>> exchange)
>> >> >> throws
>> >> >> >> MessagingException {
>> >> >> >>
>> >> >> >>                NormalizedMessage message = exchange.getMessage
>> >> ("in");
>> >> >> >>                        if (message == null) {
>> >> >> >>                                log.warn("Received null message
>> from
>> >> >> >> exchange: " + exchange);
>> >> >> >>                        } else {
>> >> >> >>                                log.info("Exchange: " + exchange
>> +
>> "
>> >> >> >> received IN message: "
>> >> >> >>                                                + message);
>> >> >> >>                                try {
>> >> >> >>                                        log.info("Body is: "
>> >> >> >>                                                        +
>> >> >> >> sourceTransformer.toString(message.getContent()));
>> >> >> >>                                } catch (TransformerException e)
>> {
>> >> >> >>                                        log.error("Failed to turn
>> >> >> message
>> >> >> >> body into text: " + e, e);
>> >> >> >>                                }
>> >> >> >>                        }
>> >> >> >>                        done(exchange);
>> >> >> >>                        log.info("MESSAGGIO RICEVUTO");
>> >> >> >>
>> >> >> >>                  log.info("COPIO IL PACCHETTO");
>> >> >> >>
>> >> >> >>                        MessageExchange scambio =
>> >> >> >> (MessageExchange)exchange;
>> >> >> >>                        log.info("IL PACCHETTO COPIATO E': "
>> >> +scambio);
>> >> >> >>
>> >> >> >>
>> >> >> >>                if (exchange.getStatus() != ExchangeStatus.DONE)
>> {
>> >> >> >>                        log.info("RITORNA PERCHE' LO STATO E': "
>> >> >> >> +exchange.getStatus());
>> >> >> >>                    return;
>> >> >> >>                }
>> >> >> >>                // This is a notification from the WSN broker
>> >> >> >>                if
>> >> >> >>
>> >> >>
>> >>
>> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
>> >> >> {
>> >> >> >>                    try {
>> >> >> >>                        JAXBContext jaxbContext =
>> >> >> >> JAXBContext.newInstance(Subscribe.class);
>> >> >> >>                        Source src = exchange.getMessage
>> >> >> >> ("in").getContent();
>> >> >> >>                        Object input =
>> >> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
>> >> >> >>                        if (input instanceof Subscribe) {
>> >> >> >>                            subscription = (Subscribe) input;
>> >> >> >>                            SubscribeResponse response = new
>> >> >> >> SubscribeResponse();
>> >> >> >>                            String wsaAddress =
>> >> >> >> getService().getNamespaceURI() +
>> >> >> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>> >> >> >>
>> >> >> >> response.setSubscriptionReference(AbstractWSAClient.createWSA
>> >> >> >> (wsaAddress));
>> >> >> >>                            StringWriter writer = new
>> >> StringWriter();
>> >> >> >>                            jaxbContext.createMarshaller
>> >> >> >> ().marshal(response,
>> >> >> >> writer);
>> >> >> >>                            NormalizedMessage out =
>> >> >> exchange.createMessage
>> >> >> >> ();
>> >> >> >>                            out.setContent(new
>> >> >> >> StringSource(writer.toString
>> >> >> >> ()));
>> >> >> >>                            exchange.setMessage(out, "out");
>> >> >> >>                            send(exchange);
>> >> >> >>
>> >> >> >>                        } else if (input instanceof Unsubscribe)
>> {
>> >> >> >>                            subscription = null;
>> >> >> >>                            UnsubscribeResponse response = new
>> >> >> >> UnsubscribeResponse();
>> >> >> >>                            StringWriter writer = new
>> >> StringWriter();
>> >> >> >>                            jaxbContext.createMarshaller
>> >> >> >> ().marshal(response,
>> >> >> >> writer);
>> >> >> >>                            NormalizedMessage out =
>> >> >> exchange.createMessage
>> >> >> >> ();
>> >> >> >>                            out.setContent(new
>> >> >> >> StringSource(writer.toString
>> >> >> >> ()));
>> >> >> >>                            exchange.setMessage(out, "out");
>> >> >> >>                            send(exchange);
>> >> >> >>
>> >> >> >>
>> >> >> >>                        } else {
>> >> >> >>                            throw new Exception("Unkown
>> request");
>> >> >> >>                        }
>> >> >> >>                    } catch (Exception e) {
>> >> >> >>                        fail(exchange, e);
>> >> >> >>                    }
>> >> >> >>                // This is a notification to publish
>> >> >> >>                }
>> >> >> >>
>> >> >> >>                  else {
>> >> >> >>                    try {
>> >> >> >>                        if (!demand || subscription != null) {
>> >> >> >>                            Element elem = new
>> >> >> >> SourceTransformer().toDOMElement(exchange.getMessage("in"));
>> >> >> >>                            wsnBroker.notify(receiveTopic, elem);
>> >> >> >>                            done(exchange);
>> >> >> >>                        } else {
>> >> >> >>                            log.info("Ingore notification as the
>> >> >> publisher
>> >> >> >> is no
>> >> >> >> subscribers");
>> >> >> >>                        }
>> >> >> >>                    } catch (Exception e) {
>> >> >> >>                        fail(exchange, e);
>> >> >> >>                        }
>> >> >> >>                }
>> >> >> >>            }
>> >> >> >>
>> >> >> >>  }
>> >> >> >>
>> >> >> >>  ......
>> >> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> >> >> messageId
>> >> >> >> =
>> >> >> >> ID:martina-39597-1199704995676-3:0:1:1:5, originalDestination =
>> >> null,
>> >> >> >> originalTransactionId = null, producerId =
>> >> >> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
>> >> >> >> queue://org.apache.servicemix.jms.{
>> >> >> >>
>> >> >>
>> >>
>> http://servicemix.apache.org/demo}trace:endpoint<http://servicemix.apache.org/demo%7Dtrace:endpoint>
>> <http://servicemix.apache.org/demo%7Dtrace:endpoint>
>> >> <http://servicemix.apache.org/demo%7Dtrace:endpoint>
>> >> >> <http://servicemix.apache.org/demo%7Dtrace:endpoint>
>> >> >> >> ,
>> >> >> >> transactionId = null, expiration = 0, timestamp = 1199705011173,
>> >> >> arrival
>> >> >> >> =
>> >> >> >> 0, correlationId = null, replyTo = null, persistent = true, type
>> =
>> >> >> null,
>> >> >> >> priority = 4, groupID = null, groupSequence = 0,
>> targetConsumerId
>> =
>> >> >> null,
>> >> >> >> compressed = false, userID = null, content =
>> >> >> >> org.apache.activemq.util.ByteSequence@10a69f0,
>> marshalledProperties
>> >> =
>> >> >> >> null,
>> >> >> >> dataStructure = null, redeliveryCounter = 0, size = 0,
>> properties
>> =
>> >> >> null,
>> >> >> >> readOnlyProperties = true, readOnlyBody = true, droppable =
>> false}
>> >> >> >> INFO  - SubscriberComponent            - Exchange: InOnly[
>> >> >> >>  id: ID:192.168.0.172-11753fdefba-2:0
>> >> >> >>  status: Active
>> >> >> >>  role: provider
>> >> >> >>  endpoint: endpoint
>> >> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> >> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >> >> >>
>> >> >>
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing
>> "><name>My
>> >> >> >> Example
>> >> >> >>
>> Job</name><group>ServiceMix</group><fullname>ServiceMix.MyExample
>> >> >> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> >> >> ] received IN message:
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> org.apache.servicemix.jbi.messaging.NormalizedMessageImpl@b125bd{properties
>> >> >> >> :
>> >> >> >> {}}
>> >> >> >> INFO  - SubscriberComponent            - Body is: <?xml
>> >> version="1.0
>> >> "
>> >> >> >> encoding="UTF-8"?><ns2:Notify xmlns:ns2="
>> >> >> >> http://docs.oasis-open.org/wsn/b-2"
>> >> >> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >> >> >>
>> >> >>
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing
>> "><name>My
>> >> >> >> Example
>> >> >> >>
>> Job</name><group>ServiceMix</group><fullname>ServiceMix.MyExample
>> >> >> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
>> LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
>> >> >> status
>> >> >> =
>> >> >> >> getStatus()
>> >> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E
>> CAMBIA
>> >> LO
>> >> >> >> STATO
>> >> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> me.handleSend(sync)
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> >> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> >> container.sendExchange(mirror);
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> >> >> messageId
>> >> >> >> =
>> >> >> >> ID:martina-39597-1199704995676-3:0:1:1:6, originalDestination =
>> >> null,
>> >> >> >> originalTransactionId = null, producerId =
>> >> >> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
>> >> >> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
>> >> >> expiration
>> >> >> >> =
>> >> >> >> 0, timestamp = 1199705011183, arrival = 0, correlationId = null,
>> >> >> replyTo
>> >> >> >> =
>> >> >> >> null, persistent = true, type = null, priority = 4, groupID =
>> null,
>> >> >> >> groupSequence = 0, targetConsumerId = null, compressed = false,
>> >> userID
>> >> >> =
>> >> >> >> null, content = org.apache.activemq.util.ByteSequence@c70f32,
>> >> >> >> marshalledProperties = null, dataStructure = null,
>> >> redeliveryCounter
>> >> =
>> >> >> 0,
>> >> >> >> size = 0, properties = null, readOnlyProperties = true,
>> >> readOnlyBody
>> >> =
>> >> >> >> true,
>> >> >> >> droppable = false}
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> >> container.sendExchange(mirror);
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> >> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> >> >> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> >> >> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO
>> E':
>> >> >> InOnly[
>> >> >> >>  id: ID:192.168.0.172-11753fdefba-2:0
>> >> >> >>  status: Done
>> >> >> >>  role: provider
>> >> >> >>  endpoint: endpoint
>> >> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> >> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >> >> >>
>> >> >>
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing
>> "><name>My
>> >> >> >> Example
>> >> >> >>
>> Job</name><group>ServiceMix</group><fullname>ServiceMix.MyExample
>> >> >> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> >> >> ]
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
>> LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
>> >> >> status
>> >> >> =
>> >> >> >> getStatus()
>> >> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E
>> CAMBIA
>> >> LO
>> >> >> >> STATO
>> >> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> me.handleSend(sync)
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> >> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> >> DEBUG - WSNSpringComponent             - Received exchange:
>> status:
>> >> >> Done,
>> >> >> >> role: consumer
>> >> >> >> DEBUG - WSNSpringComponent             - Retrieved correlation
>> id:
>> >> >> null
>> >> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> >> >> messageId
>> >> >> >> =
>> >> >> >> ID:martina-39597-1199704995676-3:0:1:1:7, originalDestination =
>> >> null,
>> >> >> >> originalTransactionId = null, producerId =
>> >> >> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
>> >> >> >> queue://org.apache.servicemix.jms.{
>> >> >> >>
>> >> >>
>> >>
>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> >> >> ,
>> >> >> >> transactionId = null, expiration = 0, timestamp = 1199705011188,
>> >> >> arrival
>> >> >> >> =
>> >> >> >> 0, correlationId = null, replyTo = null, persistent = true, type
>> =
>> >> >> null,
>> >> >> >> priority = 4, groupID = null, groupSequence = 0,
>> targetConsumerId
>> =
>> >> >> null,
>> >> >> >> compressed = false, userID = null, content =
>> >> >> >> org.apache.activemq.util.ByteSequence@1c8f59c,
>> marshalledProperties
>> >> =
>> >> >> >> null,
>> >> >> >> dataStructure = null, redeliveryCounter = 0, size = 0,
>> properties
>> =
>> >> >> null,
>> >> >> >> readOnlyProperties = true, readOnlyBody = true, droppable =
>> false}
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> >> container.sendExchange(mirror);
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
>> LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
>> LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> ERROR - JMSFlow                        - Caught an exception
>> >> routing
>> >> >> >> ExchangePacket:
>> >> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
>> >> >> sendSync
>> >> >> >>        at
>> >> >> >>
>> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> >> >> >> MessageExchangeImpl.java:581)
>> >> >> >>        at
>> >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>> >> >> >> DeliveryChannelImpl.java:384)
>> >> >> >>        at
>> >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> >> >> >> DeliveryChannelImpl.java:444)
>> >> >> >>        at
>> >> >> >>
>> >> >>
>> >>
>> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
>> >> >> >> :249)
>> >> >> >>        at
>> >> >> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> >> >> >> SubscriberComponent.java:203)
>> >> >> >>        at
>> >> >> >>
>> >> >>
>> >>
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> >> >> >> DeliveryChannelImpl.java:621)
>> >> >> >>        at
>> >> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> >> >> >> AbstractFlow.java:174)
>> >> >> >>        at
>> org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3
>> (
>> >> >> >> JMSFlow.java:1)
>> >> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>> >> >> >> JMSFlow.java:543)
>> >> >> >>        at
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> >> >> >> (ThreadPoolExecutor.java:665)
>> >> >> >>        at
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> >> >> >> (ThreadPoolExecutor.java:690)
>> >> >> >>        at java.lang.Thread.run(Thread.java:595)
>> >> >> >>
>> >> >> >> Can you help me again?
>> >> >> >> Thanks in advance!
>> >> >> >>
>> >> >> >> Martina
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> gnodet wrote:
>> >> >> >> >
>> >> >> >> > You need to use an InOnly or RobustInOnly exchange, not an
>> InOut
>> >> >> >> exchange,
>> >> >> >> > as notifications do not have any out messages.
>> >> >> >> >
>> >> >> >> > On Jan 4, 2008 5:16 PM, martymusk <ma...@email.it> wrote:
>> >> >> >> >
>> >> >> >> >>
>> >> >> >> >> Thus , I've created a new class "SubscriberComponent" that is
>> a
>> >> >> copy
>> >> >> >> of
>> >> >> >> >> PublisherComponent. Trhough it instance2 receive exchange and
>> >> try
>> >> >> to
>> >> >> >> send
>> >> >> >> >> scambio (copy of exchange). When I run example the following
>> >> error
>> >> >> >> >> occurs...
>> >> >> >> >>
>> >> >> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired =
>> false,
>> >> >> >> messageId
>> >> >> >> >> =
>> >> >> >> >> ID:martina-38529-1199462112612-3:0:1:1:6, originalDestination
>> =
>> >> >> null,
>> >> >> >> >> originalTransactionId = null, producerId =
>> >> >> >> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
>> >> >> >> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
>> >> >> >> expiration
>> >> >> >> >> =
>> >> >> >> >> 0, timestamp = 1199462153935, arrival = 0, correlationId =
>> null,
>> >> >> >> replyTo
>> >> >> >> >> =
>> >> >> >> >> null, persistent = true, type = null, priority = 4, groupID =
>> >> null,
>> >> >> >> >> groupSequence = 0, targetConsumerId = null, compressed =
>> false,
>> >> >> userID
>> >> >> >> =
>> >> >> >> >> null, content = org.apache.activemq.util.ByteSequence@b2175,
>> >> >> >> >> marshalledProperties = null, dataStructure = null,
>> >> >> redeliveryCounter
>> >> >> =
>> >> >> >> 0,
>> >> >> >> >> size = 0, properties = null, readOnlyProperties = true,
>> >> >> readOnlyBody
>> >> >> =
>> >> >> >> >> true,
>> >> >> >> >> droppable = false}
>> >> >> >> >> DEBUG - WSNSpringComponent             - Received exchange:
>> >> status:
>> >> >> >> >> Active,
>> >> >> >> >> role: consumer
>> >> >> >> >> DEBUG - WSNSpringComponent             - Retrieved
>> correlation
>> >> id:
>> >> >> >> null
>> >> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> >> >> container.sendExchange(mirror);
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> >> >> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> >> >> >> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> >> >> >> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO
>> >> E':
>> >> >> >> InOut[
>> >> >> >> >>  id: ID:192.168.0.172-1174583cdf9-2:0
>> >> >> >> >>  status: Active
>> >> >> >> >>  role: provider
>> >> >> >> >>  endpoint: endpoint
>> >> >> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> >> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> >> >> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> >> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> >> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> >> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing
>> >> "><name>My
>> >> >> >> >> Example
>> >> >> >> >>
>> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.MyExample
>> >> >> >> >> Job</fullname><description/><fireTime>Fri Jan 04 16:55:53 CET
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> >> >> >> ]
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
>> >> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
>> >> LISTNERS
>> >> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> >> >> INFO  - MessageExchangeImpl            - PRIMA DI
>> ExchangeStatus
>> >> >> >> status
>> >> >> >> =
>> >> >> >> >> getStatus()
>> >> >> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E
>> >> CAMBIA
>> >> >> LO
>> >> >> >> >> STATO
>> >> >> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> >> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> >> me.handleSend(sync)
>> >> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> >> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> >> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired =
>> false,
>> >> >> >> messageId
>> >> >> >> >> =
>> >> >> >> >> ID:martina-38529-1199462112612-3:0:1:1:7, originalDestination
>> =
>> >> >> null,
>> >> >> >> >> originalTransactionId = null, producerId =
>> >> >> >> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
>> >> >> >> >> queue://org.apache.servicemix.jms.{
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> >> >>
>> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker
>> >
>> >> >> >> >> ,
>> >> >> >> >> transactionId = null, expiration = 0, timestamp =
>> 1199462153952,
>> >> >> >> arrival
>> >> >> >> >> =
>> >> >> >> >> 0, correlationId = null, replyTo = null, persistent = true,
>> type
>> >> =
>> >> >> >> null,
>> >> >> >> >> priority = 4, groupID = null, groupSequence = 0,
>> >> targetConsumerId
>> >> =
>> >> >> >> null,
>> >> >> >> >> compressed = false, userID = null, content =
>> >> >> >> >> org.apache.activemq.util.ByteSequence@779b3e,
>> >> marshalledProperties
>> >> >> =
>> >> >> >> >> null,
>> >> >> >> >> dataStructure = null, redeliveryCounter = 0, size = 0,
>> >> properties
>> >> =
>> >> >> >> null,
>> >> >> >> >> readOnlyProperties = true, readOnlyBody = true, droppable =
>> >> false}
>> >> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> >> >> container.sendExchange(mirror);
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E'
>> CHIUSO
>> >> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
>> >> LISTNERS
>> >> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E'
>> CHIUSO
>> >> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
>> >> LISTNERS
>> >> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> >> ERROR - JMSFlow                        - Caught an exception
>> >> >> routing
>> >> >> >> >> ExchangePacket:
>> >> >> >> >> javax.jbi.messaging.MessagingException: illegal call to send
>> /
>> >> >> >> sendSync
>> >> >> >> >>        at
>> >> >> >> >>
>> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> >> >> >> >> MessageExchangeImpl.java:581)
>> >> >> >> >>        at
>> >> >> >> >>
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend
>> (
>> >> >> >> >> DeliveryChannelImpl.java:384)
>> >> >> >> >>        at
>> >> >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> >> >> >> >> DeliveryChannelImpl.java:444)
>> >> >> >> >>        at
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
>> >> >> >> >> :249)
>> >> >> >> >>        at
>> >> >> >> >>
>> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> >> >> >> >> SubscriberComponent.java:203)
>> >> >> >> >>        at
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> >> >> >> >> DeliveryChannelImpl.java:621)
>> >> >> >> >>        at
>> >> >> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> >> >> >> >> AbstractFlow.java:174)
>> >> >> >> >>        at
>> >> org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3
>> >> (
>> >> >> >> >> JMSFlow.java:1)
>> >> >> >> >>        at
>> org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run
>> (
>> >> >> >> >> JMSFlow.java:543)
>> >> >> >> >>        at
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> >> >> >> >> (ThreadPoolExecutor.java:665)
>> >> >> >> >>        at
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> >> >> >> >> (ThreadPoolExecutor.java:690)
>> >> >> >> >>        at java.lang.Thread.run(Thread.java:595)
>> >> >> >> >>
>> >> >> >> >> I do wrong again?
>> >> >> >> >>
>> >> >> >> >> Thank you!!!
>> >> >> >> >> Martina
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> gnodet wrote:
>> >> >> >> >> >
>> >> >> >> >> > You should have a look at the existing code:
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/spring/PublisherComponent.java?r=602828
>> >> >> >> >> >
>> >> >> >> >> > Note that the publisher component actually use the client
>> api
>> >> >> (line
>> >> >> >> >> 172).
>> >> >> >> >> > For details on thow the client api works (which is how to
>> send
>> >> a
>> >> >> JBI
>> >> >> >> >> > exchange to the WSN broker), see:
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/client/NotificationBroker.java?r=602828#l89
>> >> >> >> >> >
>> >> >> >> >> > I would advise you to start from the publisher component,
>> copy
>> >> it
>> >> >> >> and
>> >> >> >> >> use
>> >> >> >> >> > it
>> >> >> >> >> > instead of your TraceComponent.
>> >> >> >> >> > Each time it receives a JBI exchange, it will publish it
>> >> through
>> >> >> the
>> >> >> >> >> > WSNotification broker.
>> >> >> >> >> >
>> >> >> >> >> > Also look at the various resources on the web site that may
>> >> help
>> >> >> >> you:
>> >> >> >> >> >   http://servicemix.apache.org/servicemix-wsn2005.html
>> >> >> >> >> >   http://servicemix.apache.org/example-scenario.html
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > On Jan 4, 2008 2:58 PM, martymusk <ma...@email.it>
>> wrote:
>> >> >> >> >> >
>> >> >> >> >> >>
>> >> >> >> >> >> Hy gnodet and thank you very much for your helpfulness,
>> >> >> >> >> >> but I don't understand exactly what I must to do.
>> >> >> >> >> >>
>> >> >> >> >> >> How can I send JBI exchange to the WSN broker directly?
>> >> >> >> >> >> How can I use WSN client api.
>> >> >> >> >> >>
>> >> >> >> >> >> I'm working for a thesis at University of Naples.
>> >> >> >> >> >> My purpose is to study WSN performance.
>> >> >> >> >> >> I've found your WSN implementation very useful for me, but
>> to
>> >> >> study
>> >> >> >> >> >> performance, I need exchange was send back.
>> >> >> >> >> >> It is more than a mounth I'm triyng to do this.
>> >> >> >> >> >>
>> >> >> >> >> >> I would be very grateful if you can help me. Otherwise,
>> there
>> >> >> are
>> >> >> >> no
>> >> >> >> >> >> problems, I'll keep on study over and over again, hoping I
>> be
>> >> >> able
>> >> >> >> to
>> >> >> >> >> >> achieve my purpose.
>> >> >> >> >> >>
>> >> >> >> >> >> Thank you very much.
>> >> >> >> >> >> Martina
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >> gnodet wrote:
>> >> >> >> >> >> >
>> >> >> >> >> >> > I thought I pointed you to the right direction.
>> >> >> >> >> >> > Do not use the PublisherComponent that way: either use
>> it
>> >> as
>> >> >> it
>> >> >> >> is
>> >> >> >> >> >> > intended
>> >> >> >> >> >> > (deploy it as a component onto the lightweight
>> container)
>> >> or
>> >> >> use
>> >> >> >> the
>> >> >> >> >> >> WSN
>> >> >> >> >> >> > client api:
>> >> >> >> >> >> >    wsn.notify(topic, msg)
>> >> >> >> >> >> >
>> >> >> >> >> >> > I'm not sure what you are trying to achieve with your
>> >> >> >> >> TraceComponent.
>> >> >> >> >> >>  It
>> >> >> >> >> >> > sounds like you want to reimplement the
>> PublisherComponent.
>> >> >> If
>> >> >> >> so,
>> >> >> >> >> you
>> >> >> >> >> >> > should have a look at how it is implemented and patch
>> it.
>> >> >> >> >> >> >
>> >> >> >> >> >> > Also note that both PublisherComponent and the WSN
>> client
>> >> api
>> >> >> are
>> >> >> >> >> just
>> >> >> >> >> >> > sugar, you can send a JBI exchange to the WSN broker
>> >> directly
>> >> >> if
>> >> >> >> you
>> >> >> >> >> >> want.
>> >> >> >> >> >> >
>> >> >> >> >> >> > On Jan 4, 2008 2:13 PM, martymusk <ma...@email.it>
>> >> wrote:
>> >> >> >> >> >> >
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> My problem is always the same!
>> >> >> >> >> >> >> In wsn-example, after Consumer received an exchange,
>> I'd
>> >> like
>> >> >> it
>> >> >> >> >> send
>> >> >> >> >> >> >> copy
>> >> >> >> >> >> >> of it. But it doesn't happen. :-(
>> >> >> >> >> >> >> I've modified TraceComponent class in the following
>> way,
>> >> but
>> >> >> it
>> >> >> >> >> >> doesn't
>> >> >> >> >> >> >> work
>> >> >> >> >> >> >> fine:
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> package org.apache.servicemix.wsn;
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> import java.io.StringWriter;
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> import javax.jbi.JBIException;
>> >> >> >> >> >> >> import javax.jbi.messaging.ExchangeStatus;
>> >> >> >> >> >> >> import javax.jbi.messaging.MessageExchange;
>> >> >> >> >> >> >> import javax.jbi.messaging.MessagingException;
>> >> >> >> >> >> >> import javax.jbi.messaging.NormalizedMessage;
>> >> >> >> >> >> >> import javax.xml.bind.JAXBContext;
>> >> >> >> >> >> >> import javax.xml.transform.Source;
>> >> >> >> >> >> >> import javax.xml.transform.TransformerException;
>> >> >> >> >> >> >> //import javax.jbi.messaging.InOut;
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> import
>> >> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl
>> >> >> ;
>> >> >> >> >> >> >> import org.apache.servicemix.jbi.messaging.InOutImpl;
>> >> >> >> >> >> >> import org.apache.commons.logging.Log;
>> >> >> >> >> >> >> import org.apache.commons.logging.LogFactory;
>> >> >> >> >> >> >> import org.apache.servicemix.MessageExchangeListener;
>> >> >> >> >> >> >> import
>> >> >> org.apache.servicemix.components.util.ComponentSupport;
>> >> >> >> >> >> >> import
>> >> org.apache.servicemix.wsn.spring.PublisherComponent;
>> >> >> >> >> >> >> import
>> org.apache.servicemix.jbi.jaxp.SourceTransformer;
>> >> >> >> >> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
>> >> >> >> >> >> >> import
>> org.apache.servicemix.wsn.client.AbstractWSAClient;
>> >> >> >> >> >> >> import
>> >> org.apache.servicemix.wsn.client.NotificationBroker;
>> >> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
>> >> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
>> >> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
>> >> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
>> >> >> >> >> >> >> import org.w3c.dom.Element;
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> public class TraceComponent extends ComponentSupport
>> >> >> implements
>> >> >> >> >> >> >>                MessageExchangeListener {
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>        private Log log =
>> >> >> >> LogFactory.getLog(TraceComponent.class);
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>        private SourceTransformer sourceTransformer =
>> new
>> >> >> >> >> >> >> SourceTransformer();
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>        public Log getLog() {
>> >> >> >> >> >> >>                return log;
>> >> >> >> >> >> >>        }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>        public void setLog(Log log) {
>> >> >> >> >> >> >>                this.log = log;
>> >> >> >> >> >> >>        }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>        public SourceTransformer getSourceTransformer()
>> {
>> >> >> >> >> >> >>                return sourceTransformer;
>> >> >> >> >> >> >>        }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>        public void
>> setSourceTransformer(SourceTransformer
>> >> >> >> >> >> >> sourceTransformer) {
>> >> >> >> >> >> >>                this.sourceTransformer =
>> sourceTransformer;
>> >> >> >> >> >> >>        }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>        //AGGIUNGO CODICE
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>        PublisherComponent publisher = new
>> >> >> PublisherComponent();
>> >> >> >> >> >> >>          private String subscriptionEndpoint =
>> >> >> "subscription";
>> >> >> >> >> >> >>          private NotificationBroker wsnBroker;
>> >> >> >> >> >> >>          private String topic;
>> >> >> >> >> >> >>          private String msg;
>> >> >> >> >> >> >>          private boolean demand;
>> >> >> >> >> >> >>          private Subscribe subscription;
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>          public String getTopic() {
>> >> >> >> >> >> >>                return topic;
>> >> >> >> >> >> >>            }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>            /**
>> >> >> >> >> >> >>             * @param topic The topic to set.
>> >> >> >> >> >> >>             */
>> >> >> >> >> >> >>            public void setTopic(String topic) {
>> >> >> >> >> >> >>               this.topic = topic;
>> >> >> >> >> >> >>            }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>         public void init() throws JBIException {
>> >> >> >> >> >> >>                super.init();
>> >> >> >> >> >> >>
>>  getContext().activateEndpoint(getService(),
>> >> >> >> >> >> >> subscriptionEndpoint);
>> >> >> >> >> >> >>                 log.info("METODO INIT");
>> >> >> >> >> >> >>                // publisher.init();
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                 publisher.setTopic(topic);
>> >> >> >> >> >> >>            }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>            /* (non-Javadoc)
>> >> >> >> >> >> >>             * @see
>> >> >> javax.jbi.management.LifeCycleMBean#start()
>> >> >> >> >> >> >>             */
>> >> >> >> >> >> >>            public void start() throws JBIException {
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                log.info("METODO START");
>> >> >> >> >> >> >>                //publisher.start();
>> >> >> >> >> >> >>                new Thread() {
>> >> >> >> >> >> >>                  public void run() {
>> >> >> >> >> >> >>                       try {
>> >> >> >> >> >> >>                           wsnBroker = new
>> >> >> >> >> >> >> NotificationBroker(getContext());
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                           String wsaAddress =
>> >> >> >> >> >> >> getService().getNamespaceURI() + "/"
>> >> >> >> >> >> >> + getService().getLocalPart() + "/" +
>> >> subscriptionEndpoint;
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >>
>> >> >>
>> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
>> >> >> >> >> >> >>
>> >> topic,
>> >> >> >> >> >> >>
>> >> >>  demand);
>> >> >> >> >> >> >>                        } catch (Exception e) {
>> >> >> >> >> >> >>                            log.error("Could not create
>> wsn
>> >> >> >> client",
>> >> >> >> >> >> e);
>> >> >> >> >> >> >>                        }
>> >> >> >> >> >> >>                    }
>> >> >> >> >> >> >>                }.start();
>> >> >> >> >> >> >>            }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>            public void shutDown() throws JBIException {
>> >> >> >> >> >> >>                log.info("METODO SHUTDOWN");
>> >> >> >> >> >> >>            //  publisher.shutDown();
>> >> >> >> >> >> >>               super.shutDown();
>> >> >> >> >> >> >>            }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>            //FINE CODICE AGGIUNTO
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>        public void onMessageExchange(MessageExchange
>> >> >> exchange)
>> >> >> >> >> >> >>                        throws MessagingException {
>> >> >> >> >> >> >>                // lets dump the incoming message
>> >> >> >> >> >> >>                NormalizedMessage message =
>> >> >> exchange.getMessage
>> >> >> >> >> ("in");
>> >> >> >> >> >> >>                if (message == null) {
>> >> >> >> >> >> >>                        log.warn("Received null message
>> >> from
>> >> >> >> >> exchange:
>> >> >> >> >> >> "
>> >> >> >> >> >> +
>> >> >> >> >> >> >> exchange);
>> >> >> >> >> >> >>                } else {
>> >> >> >> >> >> >>                        log.info("Exchange: " + exchange
>> +
>> >> "
>> >> >> >> >> received
>> >> >> >> >> >> IN
>> >> >> >> >> >> >> message: "
>> >> >> >> >> >> >>                                        + message);
>> >> >> >> >> >> >>                        try {
>> >> >> >> >> >> >>                                log.info("Body is: "
>> >> >> >> >> >> >>                                                +
>> >> >> >> >> >> >> sourceTransformer.toString(message.getContent()));
>> >> >> >> >> >> >>                        } catch (TransformerException e)
>> {
>> >> >> >> >> >> >>                                log.error("Failed to
>> turn
>> >> >> message
>> >> >> >> >> body
>> >> >> >> >> >> >> into
>> >> >> >> >> >> >> text: " + e, e);
>> >> >> >> >> >> >>                        }
>> >> >> >> >> >> >>                }
>> >> >> >> >> >> >>                done(exchange);
>> >> >> >> >> >> >>                log.info("MESSAGGIO RICEVUTO");
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                log.info("COPIO IL PACCHETTO");
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                MessageExchange scambio =
>> >> >> >> (MessageExchange)exchange;
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                log.info("INVIO");
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>          try{
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                log.info("FASE INVIO");
>> >> >> >> >> >> >>                //publisher.onMessageExchange(scambio);
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                //AGGIUNGO onMessageExchange
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                if (exchange.getStatus() !=
>> >> >> >> ExchangeStatus.ACTIVE)
>> >> >> >> {
>> >> >> >> >> >> >>                    return;
>> >> >> >> >> >> >>                }
>> >> >> >> >> >> >>                // This is a notification from the WSN
>> >> broker
>> >> >> >> >> >> >>                if
>> >> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
>> >> >> >> >> >> {
>> >> >> >> >> >> >>                    try {
>> >> >> >> >> >> >>                        JAXBContext jaxbContext =
>> >> >> >> >> >> >> JAXBContext.newInstance(Subscribe.class);
>> >> >> >> >> >> >>                        Source src = exchange.getMessage
>> >> >> >> >> >> >> ("in").getContent();
>> >> >> >> >> >> >>                        Object input =
>> >> >> >> >> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
>> >> >> >> >> >> >>                        if (input instanceof Subscribe)
>> {
>> >> >> >> >> >> >>                            subscription = (Subscribe)
>> >> input;
>> >> >> >> >> >> >>                            SubscribeResponse response =
>> >> new
>> >> >> >> >> >> >> SubscribeResponse();
>> >> >> >> >> >> >>                            String wsaAddress =
>> >> >> >> >> >> >> getService().getNamespaceURI() +
>> >> >> >> >> >> >> "/" + getService().getLocalPart() + "/" +
>> >> >> subscriptionEndpoint;
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> response.setSubscriptionReference(
>> >> AbstractWSAClient.createWSA
>> >> >> >> >> >> >> (wsaAddress));
>> >> >> >> >> >> >>                            StringWriter writer = new
>> >> >> >> >> StringWriter();
>> >> >> >> >> >> >>                            jaxbContext.createMarshaller
>> >> >> >> >> >> >> ().marshal(response,
>> >> >> >> >> >> >> writer);
>> >> >> >> >> >> >>                            NormalizedMessage out =
>> >> >> >> >> >> exchange.createMessage
>> >> >> >> >> >> >> ();
>> >> >> >> >> >> >>                            out.setContent(new
>> >> >> >> >> >> >> StringSource(writer.toString
>> >> >> >> >> >> >> ()));
>> >> >> >> >> >> >>                            exchange.setMessage(out,
>> >> "out");
>> >> >> >> >> >> >>                            send(exchange);
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                        } else if (input instanceof
>> >> >> Unsubscribe)
>> >> >> >> {
>> >> >> >> >> >> >>                            subscription = null;
>> >> >> >> >> >> >>                            UnsubscribeResponse response
>> =
>> >> new
>> >> >> >> >> >> >> UnsubscribeResponse();
>> >> >> >> >> >> >>                            StringWriter writer = new
>> >> >> >> >> StringWriter();
>> >> >> >> >> >> >>                            jaxbContext.createMarshaller
>> >> >> >> >> >> >> ().marshal(response,
>> >> >> >> >> >> >> writer);
>> >> >> >> >> >> >>                            NormalizedMessage out =
>> >> >> >> >> >> exchange.createMessage
>> >> >> >> >> >> >> ();
>> >> >> >> >> >> >>                            out.setContent(new
>> >> >> >> >> >> >> StringSource(writer.toString
>> >> >> >> >> >> >> ()));
>> >> >> >> >> >> >>                            exchange.setMessage(out,
>> >> "out");
>> >> >> >> >> >> >>                            send(exchange);
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                        } else {
>> >> >> >> >> >> >>                            throw new Exception("Unkown
>> >> >> >> request");
>> >> >> >> >> >> >>                        }
>> >> >> >> >> >> >>                    } catch (Exception e) {
>> >> >> >> >> >> >>                        fail(exchange, e);
>> >> >> >> >> >> >>                    }
>> >> >> >> >> >> >>                // This is a notification to publish
>> >> >> >> >> >> >>                }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                  else {
>> >> >> >> >> >> >>                    try {
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                    log.info("SALTA");
>> >> >> >> >> >> >>                        if (!demand || subscription !=
>> >> null)
>> >> {
>> >> >> >> >> >> >>                                log.info("ENTRO
>> NELL'IF");
>> >> >> >> >> >> >>                           // Element elem = new
>> >> >> >> >> >> >> SourceTransformer().toDOMElement(exchange.getMessage
>> >> ("in"));
>> >> >> >> >> >> >>                            log.info("PRIMA DI
>> WSNBROKER");
>> >> >> >> >> >> >>                            wsnBroker.notify(topic,
>> msg);
>> >> >> >> >> >> >>                            log.info("PRIMA DI DONE");
>> >> >> >> >> >> >>
>> >> >>  getDeliveryChannel().send(exchange);
>> >> >> >> >> >> >>                            log.info("DOPO DI DONE");
>> >> >> >> >> >> >>                        } else {
>> >> >> >> >> >> >>                            log.info("Ingore
>> notification
>> >> as
>> >> >> the
>> >> >> >> >> >> publisher
>> >> >> >> >> >> >> is no
>> >> >> >> >> >> >> subscribers");
>> >> >> >> >> >> >>                        }
>> >> >> >> >> >> >>                    } catch (Exception e) {
>> >> >> >> >> >> >>                        fail(exchange, e);
>> >> >> >> >> >> >>                        }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                log.debug("IL PACCHETTO INVIATO E': " +
>> >> >> scambio);
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                  }
>> >> >> >> >> >> >>                //FINE onMessageExchange
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>           } catch(JBIException e){
>> >> >> >> >> >> >>                  log.error("ECCEZIONE GENERATA!");
>> >> >> >> >> >> >>          }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>      log.info("INVIATO");
>> >> >> >> >> >> >> }
>> >> >> >> >> >> >> }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> Help me if you can.
>> >> >> >> >> >> >> Thank you very much for your helpfulness...
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> Martina
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> gnodet wrote:
>> >> >> >> >> >> >> >
>> >> >> >> >> >> >> > You should not have to deal nor see the internal
>> state
>> >> of
>> >> >> the
>> >> >> >> >> >> exchange.
>> >> >> >> >> >> >> > If guess you have an exception when trying to send an
>> >> >> >> exchange,
>> >> >> >> >> but
>> >> >> >> >> >> >> this
>> >> >> >> >> >> >> > means that there is a problem in your code.  You
>> should
>> >> >> post
>> >> >> a
>> >> >> >> >> >> snippet
>> >> >> >> >> >> >> of
>> >> >> >> >> >> >> > your code that is failing so that we can help you.
>> >> >> >> >> >> >> >
>> >> >> >> >> >> >> > On Jan 4, 2008 12:22 PM, martymusk
>> <martymusk@email.it
>> >
>> >> >> wrote:
>> >> >> >> >> >> >> >
>> >> >> >> >> >> >> >>
>> >> >> >> >> >> >> >> Hy,
>> >> >> >> >> >> >> >> I've a question...
>> >> >> >> >> >> >> >> can I set anywhere Consumer to CAN_SEND?
>> >> >> >> >> >> >> >>
>> >> >> >> >> >> >> >> I hope you can help me.
>> >> >> >> >> >> >> >> Thank you in advance.
>> >> >> >> >> >> >> >>
>> >> >> >> >> >> >> >> Martina
>> >> >> >> >> >> >> >> --
>> >> >> >> >> >> >> >> View this message in context:
>> >> >> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >>
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
>> >> >> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive
>> at
>> >> >> >> >> Nabble.com.
>> >> >> >> >> >> >> >>
>> >> >> >> >> >> >> >>
>> >> >> >> >> >> >> >
>> >> >> >> >> >> >> >
>> >> >> >> >> >> >> > --
>> >> >> >> >> >> >> > Cheers,
>> >> >> >> >> >> >> > Guillaume Nodet
>> >> >> >> >> >> >> > ------------------------
>> >> >> >> >> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >> >> >> >> >
>> >> >> >> >> >> >> >
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> --
>> >> >> >> >> >> >> View this message in context:
>> >> >> >> >> >> >>
>> >> >> >> >>
>> >> >>
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616107.html
>> >> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> >> >> >> Nabble.com.
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >
>> >> >> >> >> >> >
>> >> >> >> >> >> > --
>> >> >> >> >> >> > Cheers,
>> >> >> >> >> >> > Guillaume Nodet
>> >> >> >> >> >> > ------------------------
>> >> >> >> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >> >> >> >
>> >> >> >> >> >> >
>> >> >> >> >> >>
>> >> >> >> >> >> --
>> >> >> >> >> >> View this message in context:
>> >> >> >> >> >>
>> >> >> >>
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616748.html
>> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> >> >> Nabble.com.
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > --
>> >> >> >> >> > Cheers,
>> >> >> >> >> > Guillaume Nodet
>> >> >> >> >> > ------------------------
>> >> >> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >>
>> >> >> >> >> --
>> >> >> >> >> View this message in context:
>> >> >> >> >>
>> >> >>
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14619757.html
>> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> >> Nabble.com.
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > --
>> >> >> >> > Cheers,
>> >> >> >> > Guillaume Nodet
>> >> >> >> > ------------------------
>> >> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >> --
>> >> >> >> View this message in context:
>> >> >> >>
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14663812.html
>> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> Nabble.com.
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > Cheers,
>> >> >> > Guillaume Nodet
>> >> >> > ------------------------
>> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14664874.html
>> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > Cheers,
>> >> > Guillaume Nodet
>> >> > ------------------------
>> >> > Blog: http://gnodet.blogspot.com/
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14665988.html
>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> > Cheers,
>> > Guillaume Nodet
>> > ------------------------
>> > Blog: http://gnodet.blogspot.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14692598.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14712093.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Consumer Can Send

Posted by Guillaume Nodet <gn...@gmail.com>.
If you are talking about the WS-Notification example from the ServiceMix
distribution, it will certainly works.  You just need to make sure multicast
is enabled on your network between your nodes, else they won't discover each
other.   Note that multicast is not a requirement and you can configure
another discovery mechanism if you need, but this is how the example is
configured.

On Jan 8, 2008 5:02 PM, martymusk <ma...@email.it> wrote:

>
> Hy gnodet,
> thank you very much.
> It run fine!!! :)
> Now I'd like to run this example on three different node.
> Do you think it's possible?
> I'd like to run instance1 on one node, instance2 on another node and
> instance3 on another again...
> Can you help me again, please?
>
> Thank you in advance,
>
> Martina
>
>
>
> gnodet wrote:
> >
> > You need to understand how exchanges are sent between components.
> > For a simple InOnly exchange, it will be the following:
> >    * consumer create the exchange and call send
> >    * provider receives the exchange (possibly in onMessageExchange)
> >    * provide set the done status and call send
> >    * consumer receives the exchange in a DONE status
> >
> > In your case, the PublisherComponent acts both as a consumer and a
> > provider,
> > because it receives an exchange and send a copy to the broker, so the
> > onMessageExchange will be called multiple times:
> >    * first when it receives the first exchange and acts as the provider
> > (it
> > creates a new exchange and send it by using the WSNotification client
> api)
> >    * then when the exchange comes back with a DONE status
> >
> > The log you pasted below is fine but is the second call to the method
> (you
> > can see the DONE status and even the content of the exchange that has
> been
> > previously sent).  Check earlier in your log and you will find what you
> > need.
> >
> > On Jan 7, 2008 2:39 PM, martymusk <ma...@email.it> wrote:
> >
> >>
> >> I've tried with original code, and it returns because status is DONE.
> >> I post output obtained with original code:
> >>
> >> DEBUG - WSNSpringComponent             - Received exchange: status:
> Done,
> >> role: consumer
> >> DEBUG - WSNSpringComponent             - Retrieved correlation id: null
> >> INFO  - DeliveryChannelImpl            - DOPO
> >> container.sendExchange(mirror);
> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
> InOnly[
> >>  id: ID:192.168.0.172-1175476963a-2:0
> >>  status: Done
> >>  role: provider
> >>  endpoint: endpoint
> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
> >> Example
> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> >> Job</fullname><description/><fireTime>Mon Jan 07 14:35:12 CET
> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> ]
> >> INFO  - SubscriberComponent            - RETURNS BECAUSE STATUS IS:
> Done
> >>
> >> So I've tried to modify ACTIVE with DONE, hoping it carry on, but it
> >> fails
> >> with error I've posted previously.
> >>
> >> I don't understand what I do wrong!
> >> It's more than a mounth I'm trying to return back exchange. :-(
> >>
> >> Thank you very much for help you give me!
> >>
> >> Martina
> >>
> >>
> >>
> >> gnodet wrote:
> >> >
> >> > Have you tried with the original code before modifying the class from
> >> > ServiceMix ?
> >> > The first lines of the SubscriberComponent#onMessageExchange are
> >> >
> >> >  if (exchange.getStatus() != ExchangeStatus.ACTIVE) {
> >> >      return;
> >> >  }
> >> >
> >> > This is because you have to ignore exchanges in an Error / Done
> status.
> >> > From the code you pasted, it seems you removed those lines and
> instead
> >> do
> >> > some copy work and call done() which will fail for exchanges that are
> >> not
> >> > active.
> >> >
> >> > You can add debugging statements if you need (debug remoting works
> fine
> >> > too), but please try with the original code first.
> >> >
> >> > On Jan 7, 2008 1:52 PM, martymusk <ma...@email.it> wrote:
> >> >
> >> >>
> >> >> Thank you very much...
> >> >> The exception is the same, I post it:
> >> >>
> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> >> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> >> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> >> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
> >> InOnly[
> >> >>  id: ID:192.168.0.172-11754495367-2:0
> >> >>  status: Done
> >> >>  role: provider
> >> >>  endpoint: endpoint
> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> >> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >> >>
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
> >> >> Example
> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> >> >> Job</fullname><description/><fireTime>Mon Jan 07 13:46:56 CET
> >> >>
> >> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> >> ]
> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
> >> status
> >> =
> >> >> getStatus()
> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA
> LO
> >> >> STATO
> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
> >> >> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >> >> DEBUG - JMSFlow                        - Called Flow send
> >> >> DEBUG - ActiveMQSession                - Sending message:
> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> >> messageId
> >> >> =
> >> >> ID:martina-39867-1199709997721-3:0:1:1:7, originalDestination =
> null,
> >> >> originalTransactionId = null, producerId =
> >> >> ID:martina-39867-1199709997721-3:0:1:1, destination =
> >> >> queue://org.apache.servicemix.jms.{
> >> >>
> >> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> >> ,
> >> >> transactionId = null, expiration = 0, timestamp = 1199710016807,
> >> arrival
> >> >> =
> >> >> 0, correlationId = null, replyTo = null, persistent = true, type =
> >> null,
> >> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
> >> null,
> >> >> compressed = false, userID = null, content =
> >> >> org.apache.activemq.util.ByteSequence@5ac5f, marshalledProperties =
> >> null,
> >> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
> >> null,
> >> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
> >> >> INFO  - DeliveryChannelImpl            - DOPO
> >> >> container.sendExchange(mirror);
> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> ERROR - JMSFlow                        - Caught an exception routing
> >> >> ExchangePacket:
> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
> >> sendSync
> >> >>        at
> >> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> >> >> MessageExchangeImpl.java:581)
> >> >>        at
> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> >> >> DeliveryChannelImpl.java:384)
> >> >>        at
> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> >> >> DeliveryChannelImpl.java:444)
> >> >>        at
> >> >>
> >> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
> >> >> :249)
> >> >>        at
> >> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> >> >> SubscriberComponent.java:204)
> >> >>        at
> >> >>
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> >> >> DeliveryChannelImpl.java:621)
> >> >>        at
> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> >> >> AbstractFlow.java:174)
> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
> >> >> JMSFlow.java:1)
> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
> >> >> JMSFlow.java:543)
> >> >>        at
> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> >> >> (ThreadPoolExecutor.java:665)
> >> >>        at
> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> >> >> (ThreadPoolExecutor.java:690)
> >> >>        at java.lang.Thread.run(Thread.java:595)
> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
> >> sendSync
> >> >>        at
> >> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> >> >> MessageExchangeImpl.java:581)
> >> >>        at
> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> >> >> DeliveryChannelImpl.java:384)
> >> >>        at
> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> >> >> DeliveryChannelImpl.java:444)
> >> >>        at
> >> >>
> >> org.apache.servicemix.components.util.PojoSupport.done(PojoSupport.java
> >> >> :193)
> >> >>        at
> >> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> >> >> SubscriberComponent.java:198)
> >> >>        at
> >> >>
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> >> >> DeliveryChannelImpl.java:621)
> >> >>        at
> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> >> >> AbstractFlow.java:174)
> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
> >> >> JMSFlow.java:1)
> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
> >> >> JMSFlow.java:543)
> >> >>        at
> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> >> >> (ThreadPoolExecutor.java:665)
> >> >>        at
> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> >> >> (ThreadPoolExecutor.java:690)
> >> >>        at java.lang.Thread.run(Thread.java:595)
> >> >>
> >> >> What do I do wrong?
> >> >> Thanks in advance!
> >> >>
> >> >> Martina
> >> >>
> >> >>
> >> >> gnodet wrote:
> >> >> >
> >> >> > Just before calling fail(exchange, e), could you display the stack
> >> >> trace
> >> >> > of
> >> >> > the exception ?
> >> >> >    e.printStackTrace()
> >> >> > and send this error ?
> >> >> > This is the real error, but it seems to be hidden by fail()
> throwing
> >> >> > another
> >> >> > excepiton.
> >> >> >
> >> >> > On Jan 7, 2008 12:32 PM, martymusk <ma...@email.it> wrote:
> >> >> >
> >> >> >>
> >> >> >> Hy gnodet,
> >> >> >> thank you for your felpfulness.
> >> >> >> Thus, I've used InOnly exchange, but I've the same error.
> >> >> >> I post you my class and the error.
> >> >> >>
> >> >> >> package org.apache.servicemix.wsn;
> >> >> >>
> >> >> >>
> >> >> >> import java.io.StringWriter;
> >> >> >>
> >> >> >> import javax.jbi.JBIException;
> >> >> >> import javax.jbi.messaging.ExchangeStatus;
> >> >> >> import javax.jbi.messaging.MessageExchange;
> >> >> >> import javax.jbi.messaging.MessagingException;
> >> >> >> import javax.jbi.messaging.NormalizedMessage;
> >> >> >> import javax.xml.bind.JAXBContext;
> >> >> >> import javax.xml.transform.Source;
> >> >> >> import javax.xml.transform.TransformerException;
> >> >> >>
> >> >> >> import org.apache.commons.logging.Log;
> >> >> >> import org.apache.commons.logging.LogFactory;
> >> >> >> import org.apache.servicemix.MessageExchangeListener;
> >> >> >> import org.apache.servicemix.components.util.ComponentSupport;
> >> >> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
> >> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
> >> >> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
> >> >> >> import org.apache.servicemix.wsn.client.NotificationBroker;
> >> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
> >> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
> >> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
> >> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
> >> >> >> import org.w3c.dom.Element;
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>  public class SubscriberComponent extends ComponentSupport
> >> implements
> >> >> >> MessageExchangeListener {
> >> >> >>
> >> >> >>            private static final Log log =
> >> >> >> LogFactory.getLog(SubscriberComponent.class);
> >> >> >>
> >> >> >>            private NotificationBroker wsnBroker;
> >> >> >>            private String receiveTopic;
> >> >> >>            private boolean demand;
> >> >> >>            private String subscriptionEndpoint = "subscription";
> >> >> >>            private Subscribe subscription;
> >> >> >>
> >> >> >>            /**
> >> >> >>             * @return Returns the demand.
> >> >> >>             */
> >> >> >>            public boolean getDemand() {
> >> >> >>                return demand;
> >> >> >>            }
> >> >> >>
> >> >> >>            /**
> >> >> >>             * @param demand The demand to set.
> >> >> >>             */
> >> >> >>            public void setDemand(boolean demand) {
> >> >> >>                this.demand = demand;
> >> >> >>            }
> >> >> >>
> >> >> >>            /**
> >> >> >>             * @return Returns the topic.
> >> >> >>             */
> >> >> >>            public String getTopic() {
> >> >> >>                return receiveTopic;
> >> >> >>            }
> >> >> >>
> >> >> >>            /**
> >> >> >>             * @param topic The topic to set.
> >> >> >>             */
> >> >> >>            public void setTopic(String receiveTopic) {
> >> >> >>                this.receiveTopic = receiveTopic;
> >> >> >>            }
> >> >> >>
> >> >> >>            /**
> >> >> >>             * @return Returns the subscription.
> >> >> >>             */
> >> >> >>            public Subscribe getSubscription() {
> >> >> >>                return subscription;
> >> >> >>            }
> >> >> >>
> >> >> >>            /* (non-Javadoc)
> >> >> >>             * @see
> >> >> >> org.apache.servicemix.jbi.management.BaseLifeCycle#init
> >> >> >> ()
> >> >> >>             */
> >> >> >>            public void init() throws JBIException {
> >> >> >>                super.init();
> >> >> >>                getContext().activateEndpoint(getService(),
> >> >> >> subscriptionEndpoint);
> >> >> >>            }
> >> >> >>
> >> >> >>            /* (non-Javadoc)
> >> >> >>             * @see javax.jbi.management.LifeCycleMBean#start()
> >> >> >>             */
> >> >> >>            public void start() throws JBIException {
> >> >> >>                new Thread() {
> >> >> >>                    public void run() {
> >> >> >>                        try {
> >> >> >>                            wsnBroker = new
> >> >> >> NotificationBroker(getContext());
> >> >> >>                            String wsaAddress =
> >> >> >> getService().getNamespaceURI() +
> >> >> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
> >> >> >>
> >> >> >>
> >> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
> >> >> >>
> >> receiveTopic,
> >> >> >>                                                        demand);
> >> >> >>                        } catch (Exception e) {
> >> >> >>                            log.error("Could not create wsn
> client",
> >> >> e);
> >> >> >>                        }
> >> >> >>                    }
> >> >> >>                }.start();
> >> >> >>            }
> >> >> >>
> >> >> >>
> >> >> >>            private SourceTransformer sourceTransformer = new
> >> >> >> SourceTransformer();
> >> >> >>
> >> >> >>            public SourceTransformer getSourceTransformer() {
> >> >> >>                        return sourceTransformer;
> >> >> >>                }
> >> >> >>
> >> >> >>                public void setSourceTransformer(SourceTransformer
> >> >> >> sourceTransformer) {
> >> >> >>                        this.sourceTransformer =
> sourceTransformer;
> >> >> >>                }
> >> >> >>
> >> >> >>            /* (non-Javadoc)
> >> >> >>             * @see javax.jbi.management.LifeCycleMBean#shutDown()
> >> >> >>             */
> >> >> >>            public void shutDown() throws JBIException {
> >> >> >>                super.shutDown();
> >> >> >>            }
> >> >> >>
> >> >> >>            /* (non-Javadoc)
> >> >> >>             * @see
> >> >> >> org.apache.servicemix.MessageExchangeListener#onMessageExchange(
> >> >> >> javax.jbi.messaging.MessageExchange)
> >> >> >>             */
> >> >> >>            public void onMessageExchange(MessageExchange
> exchange)
> >> >> throws
> >> >> >> MessagingException {
> >> >> >>
> >> >> >>                NormalizedMessage message = exchange.getMessage
> >> ("in");
> >> >> >>                        if (message == null) {
> >> >> >>                                log.warn("Received null message
> from
> >> >> >> exchange: " + exchange);
> >> >> >>                        } else {
> >> >> >>                                log.info("Exchange: " + exchange +
> "
> >> >> >> received IN message: "
> >> >> >>                                                + message);
> >> >> >>                                try {
> >> >> >>                                        log.info("Body is: "
> >> >> >>                                                        +
> >> >> >> sourceTransformer.toString(message.getContent()));
> >> >> >>                                } catch (TransformerException e) {
> >> >> >>                                        log.error("Failed to turn
> >> >> message
> >> >> >> body into text: " + e, e);
> >> >> >>                                }
> >> >> >>                        }
> >> >> >>                        done(exchange);
> >> >> >>                        log.info("MESSAGGIO RICEVUTO");
> >> >> >>
> >> >> >>                  log.info("COPIO IL PACCHETTO");
> >> >> >>
> >> >> >>                        MessageExchange scambio =
> >> >> >> (MessageExchange)exchange;
> >> >> >>                        log.info("IL PACCHETTO COPIATO E': "
> >> +scambio);
> >> >> >>
> >> >> >>
> >> >> >>                if (exchange.getStatus() != ExchangeStatus.DONE) {
> >> >> >>                        log.info("RITORNA PERCHE' LO STATO E': "
> >> >> >> +exchange.getStatus());
> >> >> >>                    return;
> >> >> >>                }
> >> >> >>                // This is a notification from the WSN broker
> >> >> >>                if
> >> >> >>
> >> >>
> >> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
> >> >> {
> >> >> >>                    try {
> >> >> >>                        JAXBContext jaxbContext =
> >> >> >> JAXBContext.newInstance(Subscribe.class);
> >> >> >>                        Source src = exchange.getMessage
> >> >> >> ("in").getContent();
> >> >> >>                        Object input =
> >> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
> >> >> >>                        if (input instanceof Subscribe) {
> >> >> >>                            subscription = (Subscribe) input;
> >> >> >>                            SubscribeResponse response = new
> >> >> >> SubscribeResponse();
> >> >> >>                            String wsaAddress =
> >> >> >> getService().getNamespaceURI() +
> >> >> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
> >> >> >>
> >> >> >> response.setSubscriptionReference(AbstractWSAClient.createWSA
> >> >> >> (wsaAddress));
> >> >> >>                            StringWriter writer = new
> >> StringWriter();
> >> >> >>                            jaxbContext.createMarshaller
> >> >> >> ().marshal(response,
> >> >> >> writer);
> >> >> >>                            NormalizedMessage out =
> >> >> exchange.createMessage
> >> >> >> ();
> >> >> >>                            out.setContent(new
> >> >> >> StringSource(writer.toString
> >> >> >> ()));
> >> >> >>                            exchange.setMessage(out, "out");
> >> >> >>                            send(exchange);
> >> >> >>
> >> >> >>                        } else if (input instanceof Unsubscribe) {
> >> >> >>                            subscription = null;
> >> >> >>                            UnsubscribeResponse response = new
> >> >> >> UnsubscribeResponse();
> >> >> >>                            StringWriter writer = new
> >> StringWriter();
> >> >> >>                            jaxbContext.createMarshaller
> >> >> >> ().marshal(response,
> >> >> >> writer);
> >> >> >>                            NormalizedMessage out =
> >> >> exchange.createMessage
> >> >> >> ();
> >> >> >>                            out.setContent(new
> >> >> >> StringSource(writer.toString
> >> >> >> ()));
> >> >> >>                            exchange.setMessage(out, "out");
> >> >> >>                            send(exchange);
> >> >> >>
> >> >> >>
> >> >> >>                        } else {
> >> >> >>                            throw new Exception("Unkown request");
> >> >> >>                        }
> >> >> >>                    } catch (Exception e) {
> >> >> >>                        fail(exchange, e);
> >> >> >>                    }
> >> >> >>                // This is a notification to publish
> >> >> >>                }
> >> >> >>
> >> >> >>                  else {
> >> >> >>                    try {
> >> >> >>                        if (!demand || subscription != null) {
> >> >> >>                            Element elem = new
> >> >> >> SourceTransformer().toDOMElement(exchange.getMessage("in"));
> >> >> >>                            wsnBroker.notify(receiveTopic, elem);
> >> >> >>                            done(exchange);
> >> >> >>                        } else {
> >> >> >>                            log.info("Ingore notification as the
> >> >> publisher
> >> >> >> is no
> >> >> >> subscribers");
> >> >> >>                        }
> >> >> >>                    } catch (Exception e) {
> >> >> >>                        fail(exchange, e);
> >> >> >>                        }
> >> >> >>                }
> >> >> >>            }
> >> >> >>
> >> >> >>  }
> >> >> >>
> >> >> >>  ......
> >> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >> >> >> DEBUG - JMSFlow                        - Called Flow send
> >> >> >> DEBUG - ActiveMQSession                - Sending message:
> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> >> >> messageId
> >> >> >> =
> >> >> >> ID:martina-39597-1199704995676-3:0:1:1:5, originalDestination =
> >> null,
> >> >> >> originalTransactionId = null, producerId =
> >> >> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
> >> >> >> queue://org.apache.servicemix.jms.{
> >> >> >>
> >> >>
> >> http://servicemix.apache.org/demo}trace:endpoint<http://servicemix.apache.org/demo%7Dtrace:endpoint>
> <http://servicemix.apache.org/demo%7Dtrace:endpoint>
> >> <http://servicemix.apache.org/demo%7Dtrace:endpoint>
> >> >> <http://servicemix.apache.org/demo%7Dtrace:endpoint>
> >> >> >> ,
> >> >> >> transactionId = null, expiration = 0, timestamp = 1199705011173,
> >> >> arrival
> >> >> >> =
> >> >> >> 0, correlationId = null, replyTo = null, persistent = true, type
> =
> >> >> null,
> >> >> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId
> =
> >> >> null,
> >> >> >> compressed = false, userID = null, content =
> >> >> >> org.apache.activemq.util.ByteSequence@10a69f0,
> marshalledProperties
> >> =
> >> >> >> null,
> >> >> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties
> =
> >> >> null,
> >> >> >> readOnlyProperties = true, readOnlyBody = true, droppable =
> false}
> >> >> >> INFO  - SubscriberComponent            - Exchange: InOnly[
> >> >> >>  id: ID:192.168.0.172-11753fdefba-2:0
> >> >> >>  status: Active
> >> >> >>  role: provider
> >> >> >>  endpoint: endpoint
> >> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> >> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> >> >> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >> >> >>
> >> >>
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing
> "><name>My
> >> >> >> Example
> >> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.MyExample
> >> >> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
> >> >> >>
> >> >> >>
> >> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> >> >> ] received IN message:
> >> >> >>
> >> >> >>
> >> >>
> >>
> org.apache.servicemix.jbi.messaging.NormalizedMessageImpl@b125bd{properties
> >> >> >> :
> >> >> >> {}}
> >> >> >> INFO  - SubscriberComponent            - Body is: <?xml
> >> version="1.0
> >> "
> >> >> >> encoding="UTF-8"?><ns2:Notify xmlns:ns2="
> >> >> >> http://docs.oasis-open.org/wsn/b-2"
> >> >> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >> >> >>
> >> >>
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing
> "><name>My
> >> >> >> Example
> >> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.MyExample
> >> >> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
> >> >> >>
> >> >> >>
> >> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
> >> >> status
> >> >> =
> >> >> >> getStatus()
> >> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E
> CAMBIA
> >> LO
> >> >> >> STATO
> >> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> me.handleSend(sync)
> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> >> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >> >> >> DEBUG - JMSFlow                        - Called Flow send
> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
> >> >> >> container.sendExchange(mirror);
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> >> >> >> DEBUG - ActiveMQSession                - Sending message:
> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> >> >> messageId
> >> >> >> =
> >> >> >> ID:martina-39597-1199704995676-3:0:1:1:6, originalDestination =
> >> null,
> >> >> >> originalTransactionId = null, producerId =
> >> >> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
> >> >> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
> >> >> expiration
> >> >> >> =
> >> >> >> 0, timestamp = 1199705011183, arrival = 0, correlationId = null,
> >> >> replyTo
> >> >> >> =
> >> >> >> null, persistent = true, type = null, priority = 4, groupID =
> null,
> >> >> >> groupSequence = 0, targetConsumerId = null, compressed = false,
> >> userID
> >> >> =
> >> >> >> null, content = org.apache.activemq.util.ByteSequence@c70f32,
> >> >> >> marshalledProperties = null, dataStructure = null,
> >> redeliveryCounter
> >> =
> >> >> 0,
> >> >> >> size = 0, properties = null, readOnlyProperties = true,
> >> readOnlyBody
> >> =
> >> >> >> true,
> >> >> >> droppable = false}
> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
> >> >> >> container.sendExchange(mirror);
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> >> >> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> >> >> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> >> >> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
> >> >> InOnly[
> >> >> >>  id: ID:192.168.0.172-11753fdefba-2:0
> >> >> >>  status: Done
> >> >> >>  role: provider
> >> >> >>  endpoint: endpoint
> >> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> >> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> >> >> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >> >> >>
> >> >>
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing
> "><name>My
> >> >> >> Example
> >> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.MyExample
> >> >> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
> >> >> >>
> >> >> >>
> >> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> >> >> ]
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
> >> >> status
> >> >> =
> >> >> >> getStatus()
> >> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E
> CAMBIA
> >> LO
> >> >> >> STATO
> >> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> me.handleSend(sync)
> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> >> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >> >> >> DEBUG - JMSFlow                        - Called Flow send
> >> >> >> DEBUG - WSNSpringComponent             - Received exchange:
> status:
> >> >> Done,
> >> >> >> role: consumer
> >> >> >> DEBUG - WSNSpringComponent             - Retrieved correlation
> id:
> >> >> null
> >> >> >> DEBUG - ActiveMQSession                - Sending message:
> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> >> >> messageId
> >> >> >> =
> >> >> >> ID:martina-39597-1199704995676-3:0:1:1:7, originalDestination =
> >> null,
> >> >> >> originalTransactionId = null, producerId =
> >> >> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
> >> >> >> queue://org.apache.servicemix.jms.{
> >> >> >>
> >> >>
> >> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> >> >> ,
> >> >> >> transactionId = null, expiration = 0, timestamp = 1199705011188,
> >> >> arrival
> >> >> >> =
> >> >> >> 0, correlationId = null, replyTo = null, persistent = true, type
> =
> >> >> null,
> >> >> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId
> =
> >> >> null,
> >> >> >> compressed = false, userID = null, content =
> >> >> >> org.apache.activemq.util.ByteSequence@1c8f59c,
> marshalledProperties
> >> =
> >> >> >> null,
> >> >> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties
> =
> >> >> null,
> >> >> >> readOnlyProperties = true, readOnlyBody = true, droppable =
> false}
> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
> >> >> >> container.sendExchange(mirror);
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> ERROR - JMSFlow                        - Caught an exception
> >> routing
> >> >> >> ExchangePacket:
> >> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
> >> >> sendSync
> >> >> >>        at
> >> >> >>
> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> >> >> >> MessageExchangeImpl.java:581)
> >> >> >>        at
> >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> >> >> >> DeliveryChannelImpl.java:384)
> >> >> >>        at
> >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> >> >> >> DeliveryChannelImpl.java:444)
> >> >> >>        at
> >> >> >>
> >> >>
> >> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
> >> >> >> :249)
> >> >> >>        at
> >> >> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> >> >> >> SubscriberComponent.java:203)
> >> >> >>        at
> >> >> >>
> >> >>
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> >> >> >> DeliveryChannelImpl.java:621)
> >> >> >>        at
> >> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> >> >> >> AbstractFlow.java:174)
> >> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3
> (
> >> >> >> JMSFlow.java:1)
> >> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
> >> >> >> JMSFlow.java:543)
> >> >> >>        at
> >> >> >>
> >> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> >> >> >> (ThreadPoolExecutor.java:665)
> >> >> >>        at
> >> >> >>
> >> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> >> >> >> (ThreadPoolExecutor.java:690)
> >> >> >>        at java.lang.Thread.run(Thread.java:595)
> >> >> >>
> >> >> >> Can you help me again?
> >> >> >> Thanks in advance!
> >> >> >>
> >> >> >> Martina
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> gnodet wrote:
> >> >> >> >
> >> >> >> > You need to use an InOnly or RobustInOnly exchange, not an
> InOut
> >> >> >> exchange,
> >> >> >> > as notifications do not have any out messages.
> >> >> >> >
> >> >> >> > On Jan 4, 2008 5:16 PM, martymusk <ma...@email.it> wrote:
> >> >> >> >
> >> >> >> >>
> >> >> >> >> Thus , I've created a new class "SubscriberComponent" that is
> a
> >> >> copy
> >> >> >> of
> >> >> >> >> PublisherComponent. Trhough it instance2 receive exchange and
> >> try
> >> >> to
> >> >> >> send
> >> >> >> >> scambio (copy of exchange). When I run example the following
> >> error
> >> >> >> >> occurs...
> >> >> >> >>
> >> >> >> >> DEBUG - JMSFlow                        - Called Flow send
> >> >> >> >> DEBUG - ActiveMQSession                - Sending message:
> >> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired =
> false,
> >> >> >> messageId
> >> >> >> >> =
> >> >> >> >> ID:martina-38529-1199462112612-3:0:1:1:6, originalDestination
> =
> >> >> null,
> >> >> >> >> originalTransactionId = null, producerId =
> >> >> >> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
> >> >> >> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
> >> >> >> expiration
> >> >> >> >> =
> >> >> >> >> 0, timestamp = 1199462153935, arrival = 0, correlationId =
> null,
> >> >> >> replyTo
> >> >> >> >> =
> >> >> >> >> null, persistent = true, type = null, priority = 4, groupID =
> >> null,
> >> >> >> >> groupSequence = 0, targetConsumerId = null, compressed =
> false,
> >> >> userID
> >> >> >> =
> >> >> >> >> null, content = org.apache.activemq.util.ByteSequence@b2175,
> >> >> >> >> marshalledProperties = null, dataStructure = null,
> >> >> redeliveryCounter
> >> >> =
> >> >> >> 0,
> >> >> >> >> size = 0, properties = null, readOnlyProperties = true,
> >> >> readOnlyBody
> >> >> =
> >> >> >> >> true,
> >> >> >> >> droppable = false}
> >> >> >> >> DEBUG - WSNSpringComponent             - Received exchange:
> >> status:
> >> >> >> >> Active,
> >> >> >> >> role: consumer
> >> >> >> >> DEBUG - WSNSpringComponent             - Retrieved correlation
> >> id:
> >> >> >> null
> >> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
> >> >> >> >> container.sendExchange(mirror);
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> >> >> >> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> >> >> >> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> >> >> >> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO
> >> E':
> >> >> >> InOut[
> >> >> >> >>  id: ID:192.168.0.172-1174583cdf9-2:0
> >> >> >> >>  status: Active
> >> >> >> >>  role: provider
> >> >> >> >>  endpoint: endpoint
> >> >> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> >> >> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> >> >> >> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> >> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> >> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> >> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing
> >> "><name>My
> >> >> >> >> Example
> >> >> >> >>
> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.MyExample
> >> >> >> >> Job</fullname><description/><fireTime>Fri Jan 04 16:55:53 CET
> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> >> >> >> ]
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
> >> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
> >> LISTNERS
> >> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> >> >> INFO  - MessageExchangeImpl            - PRIMA DI
> ExchangeStatus
> >> >> >> status
> >> >> >> =
> >> >> >> >> getStatus()
> >> >> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E
> >> CAMBIA
> >> >> LO
> >> >> >> >> STATO
> >> >> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
> >> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> >> me.handleSend(sync)
> >> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> >> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> >> >> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >> >> >> >> DEBUG - JMSFlow                        - Called Flow send
> >> >> >> >> DEBUG - ActiveMQSession                - Sending message:
> >> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired =
> false,
> >> >> >> messageId
> >> >> >> >> =
> >> >> >> >> ID:martina-38529-1199462112612-3:0:1:1:7, originalDestination
> =
> >> >> null,
> >> >> >> >> originalTransactionId = null, producerId =
> >> >> >> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
> >> >> >> >> queue://org.apache.servicemix.jms.{
> >> >> >> >>
> >> >> >>
> >> >>
> >> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> >> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker
> >
> >> >> >> >> ,
> >> >> >> >> transactionId = null, expiration = 0, timestamp =
> 1199462153952,
> >> >> >> arrival
> >> >> >> >> =
> >> >> >> >> 0, correlationId = null, replyTo = null, persistent = true,
> type
> >> =
> >> >> >> null,
> >> >> >> >> priority = 4, groupID = null, groupSequence = 0,
> >> targetConsumerId
> >> =
> >> >> >> null,
> >> >> >> >> compressed = false, userID = null, content =
> >> >> >> >> org.apache.activemq.util.ByteSequence@779b3e,
> >> marshalledProperties
> >> >> =
> >> >> >> >> null,
> >> >> >> >> dataStructure = null, redeliveryCounter = 0, size = 0,
> >> properties
> >> =
> >> >> >> null,
> >> >> >> >> readOnlyProperties = true, readOnlyBody = true, droppable =
> >> false}
> >> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
> >> >> >> >> container.sendExchange(mirror);
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E'
> CHIUSO
> >> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
> >> LISTNERS
> >> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E'
> CHIUSO
> >> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
> >> LISTNERS
> >> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> >> ERROR - JMSFlow                        - Caught an exception
> >> >> routing
> >> >> >> >> ExchangePacket:
> >> >> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
> >> >> >> sendSync
> >> >> >> >>        at
> >> >> >> >>
> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> >> >> >> >> MessageExchangeImpl.java:581)
> >> >> >> >>        at
> >> >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend
> (
> >> >> >> >> DeliveryChannelImpl.java:384)
> >> >> >> >>        at
> >> >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> >> >> >> >> DeliveryChannelImpl.java:444)
> >> >> >> >>        at
> >> >> >> >>
> >> >> >>
> >> >>
> >> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
> >> >> >> >> :249)
> >> >> >> >>        at
> >> >> >> >>
> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> >> >> >> >> SubscriberComponent.java:203)
> >> >> >> >>        at
> >> >> >> >>
> >> >> >>
> >> >>
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> >> >> >> >> DeliveryChannelImpl.java:621)
> >> >> >> >>        at
> >> >> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> >> >> >> >> AbstractFlow.java:174)
> >> >> >> >>        at
> >> org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3
> >> (
> >> >> >> >> JMSFlow.java:1)
> >> >> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run
> (
> >> >> >> >> JMSFlow.java:543)
> >> >> >> >>        at
> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> >> >> >> >> (ThreadPoolExecutor.java:665)
> >> >> >> >>        at
> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> >> >> >> >> (ThreadPoolExecutor.java:690)
> >> >> >> >>        at java.lang.Thread.run(Thread.java:595)
> >> >> >> >>
> >> >> >> >> I do wrong again?
> >> >> >> >>
> >> >> >> >> Thank you!!!
> >> >> >> >> Martina
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> gnodet wrote:
> >> >> >> >> >
> >> >> >> >> > You should have a look at the existing code:
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/spring/PublisherComponent.java?r=602828
> >> >> >> >> >
> >> >> >> >> > Note that the publisher component actually use the client
> api
> >> >> (line
> >> >> >> >> 172).
> >> >> >> >> > For details on thow the client api works (which is how to
> send
> >> a
> >> >> JBI
> >> >> >> >> > exchange to the WSN broker), see:
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/client/NotificationBroker.java?r=602828#l89
> >> >> >> >> >
> >> >> >> >> > I would advise you to start from the publisher component,
> copy
> >> it
> >> >> >> and
> >> >> >> >> use
> >> >> >> >> > it
> >> >> >> >> > instead of your TraceComponent.
> >> >> >> >> > Each time it receives a JBI exchange, it will publish it
> >> through
> >> >> the
> >> >> >> >> > WSNotification broker.
> >> >> >> >> >
> >> >> >> >> > Also look at the various resources on the web site that may
> >> help
> >> >> >> you:
> >> >> >> >> >   http://servicemix.apache.org/servicemix-wsn2005.html
> >> >> >> >> >   http://servicemix.apache.org/example-scenario.html
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > On Jan 4, 2008 2:58 PM, martymusk <ma...@email.it>
> wrote:
> >> >> >> >> >
> >> >> >> >> >>
> >> >> >> >> >> Hy gnodet and thank you very much for your helpfulness,
> >> >> >> >> >> but I don't understand exactly what I must to do.
> >> >> >> >> >>
> >> >> >> >> >> How can I send JBI exchange to the WSN broker directly?
> >> >> >> >> >> How can I use WSN client api.
> >> >> >> >> >>
> >> >> >> >> >> I'm working for a thesis at University of Naples.
> >> >> >> >> >> My purpose is to study WSN performance.
> >> >> >> >> >> I've found your WSN implementation very useful for me, but
> to
> >> >> study
> >> >> >> >> >> performance, I need exchange was send back.
> >> >> >> >> >> It is more than a mounth I'm triyng to do this.
> >> >> >> >> >>
> >> >> >> >> >> I would be very grateful if you can help me. Otherwise,
> there
> >> >> are
> >> >> >> no
> >> >> >> >> >> problems, I'll keep on study over and over again, hoping I
> be
> >> >> able
> >> >> >> to
> >> >> >> >> >> achieve my purpose.
> >> >> >> >> >>
> >> >> >> >> >> Thank you very much.
> >> >> >> >> >> Martina
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> gnodet wrote:
> >> >> >> >> >> >
> >> >> >> >> >> > I thought I pointed you to the right direction.
> >> >> >> >> >> > Do not use the PublisherComponent that way: either use it
> >> as
> >> >> it
> >> >> >> is
> >> >> >> >> >> > intended
> >> >> >> >> >> > (deploy it as a component onto the lightweight container)
> >> or
> >> >> use
> >> >> >> the
> >> >> >> >> >> WSN
> >> >> >> >> >> > client api:
> >> >> >> >> >> >    wsn.notify(topic, msg)
> >> >> >> >> >> >
> >> >> >> >> >> > I'm not sure what you are trying to achieve with your
> >> >> >> >> TraceComponent.
> >> >> >> >> >>  It
> >> >> >> >> >> > sounds like you want to reimplement the
> PublisherComponent.
> >> >> If
> >> >> >> so,
> >> >> >> >> you
> >> >> >> >> >> > should have a look at how it is implemented and patch it.
> >> >> >> >> >> >
> >> >> >> >> >> > Also note that both PublisherComponent and the WSN client
> >> api
> >> >> are
> >> >> >> >> just
> >> >> >> >> >> > sugar, you can send a JBI exchange to the WSN broker
> >> directly
> >> >> if
> >> >> >> you
> >> >> >> >> >> want.
> >> >> >> >> >> >
> >> >> >> >> >> > On Jan 4, 2008 2:13 PM, martymusk <ma...@email.it>
> >> wrote:
> >> >> >> >> >> >
> >> >> >> >> >> >>
> >> >> >> >> >> >> My problem is always the same!
> >> >> >> >> >> >> In wsn-example, after Consumer received an exchange, I'd
> >> like
> >> >> it
> >> >> >> >> send
> >> >> >> >> >> >> copy
> >> >> >> >> >> >> of it. But it doesn't happen. :-(
> >> >> >> >> >> >> I've modified TraceComponent class in the following way,
> >> but
> >> >> it
> >> >> >> >> >> doesn't
> >> >> >> >> >> >> work
> >> >> >> >> >> >> fine:
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >> package org.apache.servicemix.wsn;
> >> >> >> >> >> >>
> >> >> >> >> >> >> import java.io.StringWriter;
> >> >> >> >> >> >>
> >> >> >> >> >> >> import javax.jbi.JBIException;
> >> >> >> >> >> >> import javax.jbi.messaging.ExchangeStatus;
> >> >> >> >> >> >> import javax.jbi.messaging.MessageExchange;
> >> >> >> >> >> >> import javax.jbi.messaging.MessagingException;
> >> >> >> >> >> >> import javax.jbi.messaging.NormalizedMessage;
> >> >> >> >> >> >> import javax.xml.bind.JAXBContext;
> >> >> >> >> >> >> import javax.xml.transform.Source;
> >> >> >> >> >> >> import javax.xml.transform.TransformerException;
> >> >> >> >> >> >> //import javax.jbi.messaging.InOut;
> >> >> >> >> >> >>
> >> >> >> >> >> >> import
> >> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl
> >> >> ;
> >> >> >> >> >> >> import org.apache.servicemix.jbi.messaging.InOutImpl;
> >> >> >> >> >> >> import org.apache.commons.logging.Log;
> >> >> >> >> >> >> import org.apache.commons.logging.LogFactory;
> >> >> >> >> >> >> import org.apache.servicemix.MessageExchangeListener;
> >> >> >> >> >> >> import
> >> >> org.apache.servicemix.components.util.ComponentSupport;
> >> >> >> >> >> >> import
> >> org.apache.servicemix.wsn.spring.PublisherComponent;
> >> >> >> >> >> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
> >> >> >> >> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
> >> >> >> >> >> >> import
> org.apache.servicemix.wsn.client.AbstractWSAClient;
> >> >> >> >> >> >> import
> >> org.apache.servicemix.wsn.client.NotificationBroker;
> >> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
> >> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
> >> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
> >> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
> >> >> >> >> >> >> import org.w3c.dom.Element;
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >> public class TraceComponent extends ComponentSupport
> >> >> implements
> >> >> >> >> >> >>                MessageExchangeListener {
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >>        private Log log =
> >> >> >> LogFactory.getLog(TraceComponent.class);
> >> >> >> >> >> >>
> >> >> >> >> >> >>        private SourceTransformer sourceTransformer = new
> >> >> >> >> >> >> SourceTransformer();
> >> >> >> >> >> >>
> >> >> >> >> >> >>        public Log getLog() {
> >> >> >> >> >> >>                return log;
> >> >> >> >> >> >>        }
> >> >> >> >> >> >>
> >> >> >> >> >> >>        public void setLog(Log log) {
> >> >> >> >> >> >>                this.log = log;
> >> >> >> >> >> >>        }
> >> >> >> >> >> >>
> >> >> >> >> >> >>        public SourceTransformer getSourceTransformer() {
> >> >> >> >> >> >>                return sourceTransformer;
> >> >> >> >> >> >>        }
> >> >> >> >> >> >>
> >> >> >> >> >> >>        public void
> setSourceTransformer(SourceTransformer
> >> >> >> >> >> >> sourceTransformer) {
> >> >> >> >> >> >>                this.sourceTransformer =
> sourceTransformer;
> >> >> >> >> >> >>        }
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >>        //AGGIUNGO CODICE
> >> >> >> >> >> >>
> >> >> >> >> >> >>        PublisherComponent publisher = new
> >> >> PublisherComponent();
> >> >> >> >> >> >>          private String subscriptionEndpoint =
> >> >> "subscription";
> >> >> >> >> >> >>          private NotificationBroker wsnBroker;
> >> >> >> >> >> >>          private String topic;
> >> >> >> >> >> >>          private String msg;
> >> >> >> >> >> >>          private boolean demand;
> >> >> >> >> >> >>          private Subscribe subscription;
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >>          public String getTopic() {
> >> >> >> >> >> >>                return topic;
> >> >> >> >> >> >>            }
> >> >> >> >> >> >>
> >> >> >> >> >> >>            /**
> >> >> >> >> >> >>             * @param topic The topic to set.
> >> >> >> >> >> >>             */
> >> >> >> >> >> >>            public void setTopic(String topic) {
> >> >> >> >> >> >>               this.topic = topic;
> >> >> >> >> >> >>            }
> >> >> >> >> >> >>
> >> >> >> >> >> >>         public void init() throws JBIException {
> >> >> >> >> >> >>                super.init();
> >> >> >> >> >> >>
>  getContext().activateEndpoint(getService(),
> >> >> >> >> >> >> subscriptionEndpoint);
> >> >> >> >> >> >>                 log.info("METODO INIT");
> >> >> >> >> >> >>                // publisher.init();
> >> >> >> >> >> >>
> >> >> >> >> >> >>                 publisher.setTopic(topic);
> >> >> >> >> >> >>            }
> >> >> >> >> >> >>
> >> >> >> >> >> >>            /* (non-Javadoc)
> >> >> >> >> >> >>             * @see
> >> >> javax.jbi.management.LifeCycleMBean#start()
> >> >> >> >> >> >>             */
> >> >> >> >> >> >>            public void start() throws JBIException {
> >> >> >> >> >> >>
> >> >> >> >> >> >>                log.info("METODO START");
> >> >> >> >> >> >>                //publisher.start();
> >> >> >> >> >> >>                new Thread() {
> >> >> >> >> >> >>                  public void run() {
> >> >> >> >> >> >>                       try {
> >> >> >> >> >> >>                           wsnBroker = new
> >> >> >> >> >> >> NotificationBroker(getContext());
> >> >> >> >> >> >>
> >> >> >> >> >> >>                           String wsaAddress =
> >> >> >> >> >> >> getService().getNamespaceURI() + "/"
> >> >> >> >> >> >> + getService().getLocalPart() + "/" +
> >> subscriptionEndpoint;
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >>
> >> >> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
> >> >> >> >> >> >>
> >> topic,
> >> >> >> >> >> >>
> >> >>  demand);
> >> >> >> >> >> >>                        } catch (Exception e) {
> >> >> >> >> >> >>                            log.error("Could not create
> wsn
> >> >> >> client",
> >> >> >> >> >> e);
> >> >> >> >> >> >>                        }
> >> >> >> >> >> >>                    }
> >> >> >> >> >> >>                }.start();
> >> >> >> >> >> >>            }
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >>            public void shutDown() throws JBIException {
> >> >> >> >> >> >>                log.info("METODO SHUTDOWN");
> >> >> >> >> >> >>            //  publisher.shutDown();
> >> >> >> >> >> >>               super.shutDown();
> >> >> >> >> >> >>            }
> >> >> >> >> >> >>
> >> >> >> >> >> >>            //FINE CODICE AGGIUNTO
> >> >> >> >> >> >>
> >> >> >> >> >> >>        public void onMessageExchange(MessageExchange
> >> >> exchange)
> >> >> >> >> >> >>                        throws MessagingException {
> >> >> >> >> >> >>                // lets dump the incoming message
> >> >> >> >> >> >>                NormalizedMessage message =
> >> >> exchange.getMessage
> >> >> >> >> ("in");
> >> >> >> >> >> >>                if (message == null) {
> >> >> >> >> >> >>                        log.warn("Received null message
> >> from
> >> >> >> >> exchange:
> >> >> >> >> >> "
> >> >> >> >> >> +
> >> >> >> >> >> >> exchange);
> >> >> >> >> >> >>                } else {
> >> >> >> >> >> >>                        log.info("Exchange: " + exchange
> +
> >> "
> >> >> >> >> received
> >> >> >> >> >> IN
> >> >> >> >> >> >> message: "
> >> >> >> >> >> >>                                        + message);
> >> >> >> >> >> >>                        try {
> >> >> >> >> >> >>                                log.info("Body is: "
> >> >> >> >> >> >>                                                +
> >> >> >> >> >> >> sourceTransformer.toString(message.getContent()));
> >> >> >> >> >> >>                        } catch (TransformerException e)
> {
> >> >> >> >> >> >>                                log.error("Failed to turn
> >> >> message
> >> >> >> >> body
> >> >> >> >> >> >> into
> >> >> >> >> >> >> text: " + e, e);
> >> >> >> >> >> >>                        }
> >> >> >> >> >> >>                }
> >> >> >> >> >> >>                done(exchange);
> >> >> >> >> >> >>                log.info("MESSAGGIO RICEVUTO");
> >> >> >> >> >> >>
> >> >> >> >> >> >>                log.info("COPIO IL PACCHETTO");
> >> >> >> >> >> >>
> >> >> >> >> >> >>                MessageExchange scambio =
> >> >> >> (MessageExchange)exchange;
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >>                log.info("INVIO");
> >> >> >> >> >> >>
> >> >> >> >> >> >>          try{
> >> >> >> >> >> >>
> >> >> >> >> >> >>                log.info("FASE INVIO");
> >> >> >> >> >> >>                //publisher.onMessageExchange(scambio);
> >> >> >> >> >> >>
> >> >> >> >> >> >>                //AGGIUNGO onMessageExchange
> >> >> >> >> >> >>
> >> >> >> >> >> >>                if (exchange.getStatus() !=
> >> >> >> ExchangeStatus.ACTIVE)
> >> >> >> {
> >> >> >> >> >> >>                    return;
> >> >> >> >> >> >>                }
> >> >> >> >> >> >>                // This is a notification from the WSN
> >> broker
> >> >> >> >> >> >>                if
> >> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
> >> >> >> >> >> {
> >> >> >> >> >> >>                    try {
> >> >> >> >> >> >>                        JAXBContext jaxbContext =
> >> >> >> >> >> >> JAXBContext.newInstance(Subscribe.class);
> >> >> >> >> >> >>                        Source src = exchange.getMessage
> >> >> >> >> >> >> ("in").getContent();
> >> >> >> >> >> >>                        Object input =
> >> >> >> >> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
> >> >> >> >> >> >>                        if (input instanceof Subscribe) {
> >> >> >> >> >> >>                            subscription = (Subscribe)
> >> input;
> >> >> >> >> >> >>                            SubscribeResponse response =
> >> new
> >> >> >> >> >> >> SubscribeResponse();
> >> >> >> >> >> >>                            String wsaAddress =
> >> >> >> >> >> >> getService().getNamespaceURI() +
> >> >> >> >> >> >> "/" + getService().getLocalPart() + "/" +
> >> >> subscriptionEndpoint;
> >> >> >> >> >> >>
> >> >> >> >> >> >> response.setSubscriptionReference(
> >> AbstractWSAClient.createWSA
> >> >> >> >> >> >> (wsaAddress));
> >> >> >> >> >> >>                            StringWriter writer = new
> >> >> >> >> StringWriter();
> >> >> >> >> >> >>                            jaxbContext.createMarshaller
> >> >> >> >> >> >> ().marshal(response,
> >> >> >> >> >> >> writer);
> >> >> >> >> >> >>                            NormalizedMessage out =
> >> >> >> >> >> exchange.createMessage
> >> >> >> >> >> >> ();
> >> >> >> >> >> >>                            out.setContent(new
> >> >> >> >> >> >> StringSource(writer.toString
> >> >> >> >> >> >> ()));
> >> >> >> >> >> >>                            exchange.setMessage(out,
> >> "out");
> >> >> >> >> >> >>                            send(exchange);
> >> >> >> >> >> >>
> >> >> >> >> >> >>                        } else if (input instanceof
> >> >> Unsubscribe)
> >> >> >> {
> >> >> >> >> >> >>                            subscription = null;
> >> >> >> >> >> >>                            UnsubscribeResponse response
> =
> >> new
> >> >> >> >> >> >> UnsubscribeResponse();
> >> >> >> >> >> >>                            StringWriter writer = new
> >> >> >> >> StringWriter();
> >> >> >> >> >> >>                            jaxbContext.createMarshaller
> >> >> >> >> >> >> ().marshal(response,
> >> >> >> >> >> >> writer);
> >> >> >> >> >> >>                            NormalizedMessage out =
> >> >> >> >> >> exchange.createMessage
> >> >> >> >> >> >> ();
> >> >> >> >> >> >>                            out.setContent(new
> >> >> >> >> >> >> StringSource(writer.toString
> >> >> >> >> >> >> ()));
> >> >> >> >> >> >>                            exchange.setMessage(out,
> >> "out");
> >> >> >> >> >> >>                            send(exchange);
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >>                        } else {
> >> >> >> >> >> >>                            throw new Exception("Unkown
> >> >> >> request");
> >> >> >> >> >> >>                        }
> >> >> >> >> >> >>                    } catch (Exception e) {
> >> >> >> >> >> >>                        fail(exchange, e);
> >> >> >> >> >> >>                    }
> >> >> >> >> >> >>                // This is a notification to publish
> >> >> >> >> >> >>                }
> >> >> >> >> >> >>
> >> >> >> >> >> >>                  else {
> >> >> >> >> >> >>                    try {
> >> >> >> >> >> >>
> >> >> >> >> >> >>                    log.info("SALTA");
> >> >> >> >> >> >>                        if (!demand || subscription !=
> >> null)
> >> {
> >> >> >> >> >> >>                                log.info("ENTRO
> NELL'IF");
> >> >> >> >> >> >>                           // Element elem = new
> >> >> >> >> >> >> SourceTransformer().toDOMElement(exchange.getMessage
> >> ("in"));
> >> >> >> >> >> >>                            log.info("PRIMA DI
> WSNBROKER");
> >> >> >> >> >> >>                            wsnBroker.notify(topic, msg);
> >> >> >> >> >> >>                            log.info("PRIMA DI DONE");
> >> >> >> >> >> >>
> >> >>  getDeliveryChannel().send(exchange);
> >> >> >> >> >> >>                            log.info("DOPO DI DONE");
> >> >> >> >> >> >>                        } else {
> >> >> >> >> >> >>                            log.info("Ingore notification
> >> as
> >> >> the
> >> >> >> >> >> publisher
> >> >> >> >> >> >> is no
> >> >> >> >> >> >> subscribers");
> >> >> >> >> >> >>                        }
> >> >> >> >> >> >>                    } catch (Exception e) {
> >> >> >> >> >> >>                        fail(exchange, e);
> >> >> >> >> >> >>                        }
> >> >> >> >> >> >>
> >> >> >> >> >> >>                log.debug("IL PACCHETTO INVIATO E': " +
> >> >> scambio);
> >> >> >> >> >> >>
> >> >> >> >> >> >>                  }
> >> >> >> >> >> >>                //FINE onMessageExchange
> >> >> >> >> >> >>
> >> >> >> >> >> >>           } catch(JBIException e){
> >> >> >> >> >> >>                  log.error("ECCEZIONE GENERATA!");
> >> >> >> >> >> >>          }
> >> >> >> >> >> >>
> >> >> >> >> >> >>      log.info("INVIATO");
> >> >> >> >> >> >> }
> >> >> >> >> >> >> }
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >> Help me if you can.
> >> >> >> >> >> >> Thank you very much for your helpfulness...
> >> >> >> >> >> >>
> >> >> >> >> >> >> Martina
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >> gnodet wrote:
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > You should not have to deal nor see the internal state
> >> of
> >> >> the
> >> >> >> >> >> exchange.
> >> >> >> >> >> >> > If guess you have an exception when trying to send an
> >> >> >> exchange,
> >> >> >> >> but
> >> >> >> >> >> >> this
> >> >> >> >> >> >> > means that there is a problem in your code.  You
> should
> >> >> post
> >> >> a
> >> >> >> >> >> snippet
> >> >> >> >> >> >> of
> >> >> >> >> >> >> > your code that is failing so that we can help you.
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > On Jan 4, 2008 12:22 PM, martymusk <martymusk@email.it
> >
> >> >> wrote:
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >>
> >> >> >> >> >> >> >> Hy,
> >> >> >> >> >> >> >> I've a question...
> >> >> >> >> >> >> >> can I set anywhere Consumer to CAN_SEND?
> >> >> >> >> >> >> >>
> >> >> >> >> >> >> >> I hope you can help me.
> >> >> >> >> >> >> >> Thank you in advance.
> >> >> >> >> >> >> >>
> >> >> >> >> >> >> >> Martina
> >> >> >> >> >> >> >> --
> >> >> >> >> >> >> >> View this message in context:
> >> >> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >>
> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
> >> >> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive
> at
> >> >> >> >> Nabble.com.
> >> >> >> >> >> >> >>
> >> >> >> >> >> >> >>
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > --
> >> >> >> >> >> >> > Cheers,
> >> >> >> >> >> >> > Guillaume Nodet
> >> >> >> >> >> >> > ------------------------
> >> >> >> >> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >
> >> >> >> >> >> >>
> >> >> >> >> >> >> --
> >> >> >> >> >> >> View this message in context:
> >> >> >> >> >> >>
> >> >> >> >>
> >> >>
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616107.html
> >> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
> >> >> >> Nabble.com.
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >> > --
> >> >> >> >> >> > Cheers,
> >> >> >> >> >> > Guillaume Nodet
> >> >> >> >> >> > ------------------------
> >> >> >> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >>
> >> >> >> >> >> --
> >> >> >> >> >> View this message in context:
> >> >> >> >> >>
> >> >> >>
> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616748.html
> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
> >> >> Nabble.com.
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > --
> >> >> >> >> > Cheers,
> >> >> >> >> > Guillaume Nodet
> >> >> >> >> > ------------------------
> >> >> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >> --
> >> >> >> >> View this message in context:
> >> >> >> >>
> >> >>
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14619757.html
> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
> >> Nabble.com.
> >> >> >> >>
> >> >> >> >>
> >> >> >> >
> >> >> >> >
> >> >> >> > --
> >> >> >> > Cheers,
> >> >> >> > Guillaume Nodet
> >> >> >> > ------------------------
> >> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context:
> >> >> >>
> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14663812.html
> >> >> >> Sent from the ServiceMix - User mailing list archive at
> Nabble.com.
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >> > --
> >> >> > Cheers,
> >> >> > Guillaume Nodet
> >> >> > ------------------------
> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14664874.html
> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > Cheers,
> >> > Guillaume Nodet
> >> > ------------------------
> >> > Blog: http://gnodet.blogspot.com/
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14665988.html
> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> > ------------------------
> > Blog: http://gnodet.blogspot.com/
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14692598.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: Consumer Can Send

Posted by martymusk <ma...@email.it>.
Hy gnodet,
thank you very much.
It run fine!!! :)
Now I'd like to run this example on three different node.
Do you think it's possible?
I'd like to run instance1 on one node, instance2 on another node and
instance3 on another again...
Can you help me again, please?

Thank you in advance,

Martina



gnodet wrote:
> 
> You need to understand how exchanges are sent between components.
> For a simple InOnly exchange, it will be the following:
>    * consumer create the exchange and call send
>    * provider receives the exchange (possibly in onMessageExchange)
>    * provide set the done status and call send
>    * consumer receives the exchange in a DONE status
> 
> In your case, the PublisherComponent acts both as a consumer and a
> provider,
> because it receives an exchange and send a copy to the broker, so the
> onMessageExchange will be called multiple times:
>    * first when it receives the first exchange and acts as the provider
> (it
> creates a new exchange and send it by using the WSNotification client api)
>    * then when the exchange comes back with a DONE status
> 
> The log you pasted below is fine but is the second call to the method (you
> can see the DONE status and even the content of the exchange that has been
> previously sent).  Check earlier in your log and you will find what you
> need.
> 
> On Jan 7, 2008 2:39 PM, martymusk <ma...@email.it> wrote:
> 
>>
>> I've tried with original code, and it returns because status is DONE.
>> I post output obtained with original code:
>>
>> DEBUG - WSNSpringComponent             - Received exchange: status: Done,
>> role: consumer
>> DEBUG - WSNSpringComponent             - Retrieved correlation id: null
>> INFO  - DeliveryChannelImpl            - DOPO
>> container.sendExchange(mirror);
>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E': InOnly[
>>  id: ID:192.168.0.172-1175476963a-2:0
>>  status: Done
>>  role: provider
>>  endpoint: endpoint
>>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> xmlns="http://www.w3.org/2005/08/addressing"
>> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> Example
>> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> Job</fullname><description/><fireTime>Mon Jan 07 14:35:12 CET
>>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> ]
>> INFO  - SubscriberComponent            - RETURNS BECAUSE STATUS IS: Done
>>
>> So I've tried to modify ACTIVE with DONE, hoping it carry on, but it
>> fails
>> with error I've posted previously.
>>
>> I don't understand what I do wrong!
>> It's more than a mounth I'm trying to return back exchange. :-(
>>
>> Thank you very much for help you give me!
>>
>> Martina
>>
>>
>>
>> gnodet wrote:
>> >
>> > Have you tried with the original code before modifying the class from
>> > ServiceMix ?
>> > The first lines of the SubscriberComponent#onMessageExchange are
>> >
>> >  if (exchange.getStatus() != ExchangeStatus.ACTIVE) {
>> >      return;
>> >  }
>> >
>> > This is because you have to ignore exchanges in an Error / Done status.
>> > From the code you pasted, it seems you removed those lines and instead
>> do
>> > some copy work and call done() which will fail for exchanges that are
>> not
>> > active.
>> >
>> > You can add debugging statements if you need (debug remoting works fine
>> > too), but please try with the original code first.
>> >
>> > On Jan 7, 2008 1:52 PM, martymusk <ma...@email.it> wrote:
>> >
>> >>
>> >> Thank you very much...
>> >> The exception is the same, I post it:
>> >>
>> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
>> InOnly[
>> >>  id: ID:192.168.0.172-11754495367-2:0
>> >>  status: Done
>> >>  role: provider
>> >>  endpoint: endpoint
>> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> >> Example
>> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> >> Job</fullname><description/><fireTime>Mon Jan 07 13:46:56 CET
>> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> ]
>> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
>> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
>> status
>> =
>> >> getStatus()
>> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
>> >> STATO
>> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> >> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
>> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> DEBUG - JMSFlow                        - Called Flow send
>> >> DEBUG - ActiveMQSession                - Sending message:
>> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> messageId
>> >> =
>> >> ID:martina-39867-1199709997721-3:0:1:1:7, originalDestination = null,
>> >> originalTransactionId = null, producerId =
>> >> ID:martina-39867-1199709997721-3:0:1:1, destination =
>> >> queue://org.apache.servicemix.jms.{
>> >>
>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> ,
>> >> transactionId = null, expiration = 0, timestamp = 1199710016807,
>> arrival
>> >> =
>> >> 0, correlationId = null, replyTo = null, persistent = true, type =
>> null,
>> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
>> null,
>> >> compressed = false, userID = null, content =
>> >> org.apache.activemq.util.ByteSequence@5ac5f, marshalledProperties =
>> null,
>> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
>> null,
>> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
>> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> container.sendExchange(mirror);
>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> ERROR - JMSFlow                        - Caught an exception routing
>> >> ExchangePacket:
>> >> javax.jbi.messaging.MessagingException: illegal call to send /
>> sendSync
>> >>        at
>> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> >> MessageExchangeImpl.java:581)
>> >>        at
>> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>> >> DeliveryChannelImpl.java:384)
>> >>        at
>> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> >> DeliveryChannelImpl.java:444)
>> >>        at
>> >>
>> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
>> >> :249)
>> >>        at
>> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> >> SubscriberComponent.java:204)
>> >>        at
>> >>
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> >> DeliveryChannelImpl.java:621)
>> >>        at
>> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> >> AbstractFlow.java:174)
>> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
>> >> JMSFlow.java:1)
>> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>> >> JMSFlow.java:543)
>> >>        at
>> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> >> (ThreadPoolExecutor.java:665)
>> >>        at
>> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> >> (ThreadPoolExecutor.java:690)
>> >>        at java.lang.Thread.run(Thread.java:595)
>> >> javax.jbi.messaging.MessagingException: illegal call to send /
>> sendSync
>> >>        at
>> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> >> MessageExchangeImpl.java:581)
>> >>        at
>> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>> >> DeliveryChannelImpl.java:384)
>> >>        at
>> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> >> DeliveryChannelImpl.java:444)
>> >>        at
>> >>
>> org.apache.servicemix.components.util.PojoSupport.done(PojoSupport.java
>> >> :193)
>> >>        at
>> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> >> SubscriberComponent.java:198)
>> >>        at
>> >>
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> >> DeliveryChannelImpl.java:621)
>> >>        at
>> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> >> AbstractFlow.java:174)
>> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
>> >> JMSFlow.java:1)
>> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>> >> JMSFlow.java:543)
>> >>        at
>> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> >> (ThreadPoolExecutor.java:665)
>> >>        at
>> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> >> (ThreadPoolExecutor.java:690)
>> >>        at java.lang.Thread.run(Thread.java:595)
>> >>
>> >> What do I do wrong?
>> >> Thanks in advance!
>> >>
>> >> Martina
>> >>
>> >>
>> >> gnodet wrote:
>> >> >
>> >> > Just before calling fail(exchange, e), could you display the stack
>> >> trace
>> >> > of
>> >> > the exception ?
>> >> >    e.printStackTrace()
>> >> > and send this error ?
>> >> > This is the real error, but it seems to be hidden by fail() throwing
>> >> > another
>> >> > excepiton.
>> >> >
>> >> > On Jan 7, 2008 12:32 PM, martymusk <ma...@email.it> wrote:
>> >> >
>> >> >>
>> >> >> Hy gnodet,
>> >> >> thank you for your felpfulness.
>> >> >> Thus, I've used InOnly exchange, but I've the same error.
>> >> >> I post you my class and the error.
>> >> >>
>> >> >> package org.apache.servicemix.wsn;
>> >> >>
>> >> >>
>> >> >> import java.io.StringWriter;
>> >> >>
>> >> >> import javax.jbi.JBIException;
>> >> >> import javax.jbi.messaging.ExchangeStatus;
>> >> >> import javax.jbi.messaging.MessageExchange;
>> >> >> import javax.jbi.messaging.MessagingException;
>> >> >> import javax.jbi.messaging.NormalizedMessage;
>> >> >> import javax.xml.bind.JAXBContext;
>> >> >> import javax.xml.transform.Source;
>> >> >> import javax.xml.transform.TransformerException;
>> >> >>
>> >> >> import org.apache.commons.logging.Log;
>> >> >> import org.apache.commons.logging.LogFactory;
>> >> >> import org.apache.servicemix.MessageExchangeListener;
>> >> >> import org.apache.servicemix.components.util.ComponentSupport;
>> >> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
>> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
>> >> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
>> >> >> import org.apache.servicemix.wsn.client.NotificationBroker;
>> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
>> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
>> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
>> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
>> >> >> import org.w3c.dom.Element;
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>  public class SubscriberComponent extends ComponentSupport
>> implements
>> >> >> MessageExchangeListener {
>> >> >>
>> >> >>            private static final Log log =
>> >> >> LogFactory.getLog(SubscriberComponent.class);
>> >> >>
>> >> >>            private NotificationBroker wsnBroker;
>> >> >>            private String receiveTopic;
>> >> >>            private boolean demand;
>> >> >>            private String subscriptionEndpoint = "subscription";
>> >> >>            private Subscribe subscription;
>> >> >>
>> >> >>            /**
>> >> >>             * @return Returns the demand.
>> >> >>             */
>> >> >>            public boolean getDemand() {
>> >> >>                return demand;
>> >> >>            }
>> >> >>
>> >> >>            /**
>> >> >>             * @param demand The demand to set.
>> >> >>             */
>> >> >>            public void setDemand(boolean demand) {
>> >> >>                this.demand = demand;
>> >> >>            }
>> >> >>
>> >> >>            /**
>> >> >>             * @return Returns the topic.
>> >> >>             */
>> >> >>            public String getTopic() {
>> >> >>                return receiveTopic;
>> >> >>            }
>> >> >>
>> >> >>            /**
>> >> >>             * @param topic The topic to set.
>> >> >>             */
>> >> >>            public void setTopic(String receiveTopic) {
>> >> >>                this.receiveTopic = receiveTopic;
>> >> >>            }
>> >> >>
>> >> >>            /**
>> >> >>             * @return Returns the subscription.
>> >> >>             */
>> >> >>            public Subscribe getSubscription() {
>> >> >>                return subscription;
>> >> >>            }
>> >> >>
>> >> >>            /* (non-Javadoc)
>> >> >>             * @see
>> >> >> org.apache.servicemix.jbi.management.BaseLifeCycle#init
>> >> >> ()
>> >> >>             */
>> >> >>            public void init() throws JBIException {
>> >> >>                super.init();
>> >> >>                getContext().activateEndpoint(getService(),
>> >> >> subscriptionEndpoint);
>> >> >>            }
>> >> >>
>> >> >>            /* (non-Javadoc)
>> >> >>             * @see javax.jbi.management.LifeCycleMBean#start()
>> >> >>             */
>> >> >>            public void start() throws JBIException {
>> >> >>                new Thread() {
>> >> >>                    public void run() {
>> >> >>                        try {
>> >> >>                            wsnBroker = new
>> >> >> NotificationBroker(getContext());
>> >> >>                            String wsaAddress =
>> >> >> getService().getNamespaceURI() +
>> >> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>> >> >>
>> >> >>
>> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
>> >> >>                                                       
>> receiveTopic,
>> >> >>                                                        demand);
>> >> >>                        } catch (Exception e) {
>> >> >>                            log.error("Could not create wsn client",
>> >> e);
>> >> >>                        }
>> >> >>                    }
>> >> >>                }.start();
>> >> >>            }
>> >> >>
>> >> >>
>> >> >>            private SourceTransformer sourceTransformer = new
>> >> >> SourceTransformer();
>> >> >>
>> >> >>            public SourceTransformer getSourceTransformer() {
>> >> >>                        return sourceTransformer;
>> >> >>                }
>> >> >>
>> >> >>                public void setSourceTransformer(SourceTransformer
>> >> >> sourceTransformer) {
>> >> >>                        this.sourceTransformer = sourceTransformer;
>> >> >>                }
>> >> >>
>> >> >>            /* (non-Javadoc)
>> >> >>             * @see javax.jbi.management.LifeCycleMBean#shutDown()
>> >> >>             */
>> >> >>            public void shutDown() throws JBIException {
>> >> >>                super.shutDown();
>> >> >>            }
>> >> >>
>> >> >>            /* (non-Javadoc)
>> >> >>             * @see
>> >> >> org.apache.servicemix.MessageExchangeListener#onMessageExchange(
>> >> >> javax.jbi.messaging.MessageExchange)
>> >> >>             */
>> >> >>            public void onMessageExchange(MessageExchange exchange)
>> >> throws
>> >> >> MessagingException {
>> >> >>
>> >> >>                NormalizedMessage message = exchange.getMessage
>> ("in");
>> >> >>                        if (message == null) {
>> >> >>                                log.warn("Received null message from
>> >> >> exchange: " + exchange);
>> >> >>                        } else {
>> >> >>                                log.info("Exchange: " + exchange + "
>> >> >> received IN message: "
>> >> >>                                                + message);
>> >> >>                                try {
>> >> >>                                        log.info("Body is: "
>> >> >>                                                        +
>> >> >> sourceTransformer.toString(message.getContent()));
>> >> >>                                } catch (TransformerException e) {
>> >> >>                                        log.error("Failed to turn
>> >> message
>> >> >> body into text: " + e, e);
>> >> >>                                }
>> >> >>                        }
>> >> >>                        done(exchange);
>> >> >>                        log.info("MESSAGGIO RICEVUTO");
>> >> >>
>> >> >>                  log.info("COPIO IL PACCHETTO");
>> >> >>
>> >> >>                        MessageExchange scambio =
>> >> >> (MessageExchange)exchange;
>> >> >>                        log.info("IL PACCHETTO COPIATO E': "
>> +scambio);
>> >> >>
>> >> >>
>> >> >>                if (exchange.getStatus() != ExchangeStatus.DONE) {
>> >> >>                        log.info("RITORNA PERCHE' LO STATO E': "
>> >> >> +exchange.getStatus());
>> >> >>                    return;
>> >> >>                }
>> >> >>                // This is a notification from the WSN broker
>> >> >>                if
>> >> >>
>> >>
>> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
>> >> {
>> >> >>                    try {
>> >> >>                        JAXBContext jaxbContext =
>> >> >> JAXBContext.newInstance(Subscribe.class);
>> >> >>                        Source src = exchange.getMessage
>> >> >> ("in").getContent();
>> >> >>                        Object input =
>> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
>> >> >>                        if (input instanceof Subscribe) {
>> >> >>                            subscription = (Subscribe) input;
>> >> >>                            SubscribeResponse response = new
>> >> >> SubscribeResponse();
>> >> >>                            String wsaAddress =
>> >> >> getService().getNamespaceURI() +
>> >> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>> >> >>
>> >> >> response.setSubscriptionReference(AbstractWSAClient.createWSA
>> >> >> (wsaAddress));
>> >> >>                            StringWriter writer = new
>> StringWriter();
>> >> >>                            jaxbContext.createMarshaller
>> >> >> ().marshal(response,
>> >> >> writer);
>> >> >>                            NormalizedMessage out =
>> >> exchange.createMessage
>> >> >> ();
>> >> >>                            out.setContent(new
>> >> >> StringSource(writer.toString
>> >> >> ()));
>> >> >>                            exchange.setMessage(out, "out");
>> >> >>                            send(exchange);
>> >> >>
>> >> >>                        } else if (input instanceof Unsubscribe) {
>> >> >>                            subscription = null;
>> >> >>                            UnsubscribeResponse response = new
>> >> >> UnsubscribeResponse();
>> >> >>                            StringWriter writer = new
>> StringWriter();
>> >> >>                            jaxbContext.createMarshaller
>> >> >> ().marshal(response,
>> >> >> writer);
>> >> >>                            NormalizedMessage out =
>> >> exchange.createMessage
>> >> >> ();
>> >> >>                            out.setContent(new
>> >> >> StringSource(writer.toString
>> >> >> ()));
>> >> >>                            exchange.setMessage(out, "out");
>> >> >>                            send(exchange);
>> >> >>
>> >> >>
>> >> >>                        } else {
>> >> >>                            throw new Exception("Unkown request");
>> >> >>                        }
>> >> >>                    } catch (Exception e) {
>> >> >>                        fail(exchange, e);
>> >> >>                    }
>> >> >>                // This is a notification to publish
>> >> >>                }
>> >> >>
>> >> >>                  else {
>> >> >>                    try {
>> >> >>                        if (!demand || subscription != null) {
>> >> >>                            Element elem = new
>> >> >> SourceTransformer().toDOMElement(exchange.getMessage("in"));
>> >> >>                            wsnBroker.notify(receiveTopic, elem);
>> >> >>                            done(exchange);
>> >> >>                        } else {
>> >> >>                            log.info("Ingore notification as the
>> >> publisher
>> >> >> is no
>> >> >> subscribers");
>> >> >>                        }
>> >> >>                    } catch (Exception e) {
>> >> >>                        fail(exchange, e);
>> >> >>                        }
>> >> >>                }
>> >> >>            }
>> >> >>
>> >> >>  }
>> >> >>
>> >> >>  ......
>> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> >> messageId
>> >> >> =
>> >> >> ID:martina-39597-1199704995676-3:0:1:1:5, originalDestination =
>> null,
>> >> >> originalTransactionId = null, producerId =
>> >> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
>> >> >> queue://org.apache.servicemix.jms.{
>> >> >>
>> >>
>> http://servicemix.apache.org/demo}trace:endpoint<http://servicemix.apache.org/demo%7Dtrace:endpoint>
>> <http://servicemix.apache.org/demo%7Dtrace:endpoint>
>> >> <http://servicemix.apache.org/demo%7Dtrace:endpoint>
>> >> >> ,
>> >> >> transactionId = null, expiration = 0, timestamp = 1199705011173,
>> >> arrival
>> >> >> =
>> >> >> 0, correlationId = null, replyTo = null, persistent = true, type =
>> >> null,
>> >> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
>> >> null,
>> >> >> compressed = false, userID = null, content =
>> >> >> org.apache.activemq.util.ByteSequence@10a69f0, marshalledProperties
>> =
>> >> >> null,
>> >> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
>> >> null,
>> >> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
>> >> >> INFO  - SubscriberComponent            - Exchange: InOnly[
>> >> >>  id: ID:192.168.0.172-11753fdefba-2:0
>> >> >>  status: Active
>> >> >>  role: provider
>> >> >>  endpoint: endpoint
>> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >> >>
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> >> >> Example
>> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> >> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>> >> >>
>> >> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> >> ] received IN message:
>> >> >>
>> >> >>
>> >>
>> org.apache.servicemix.jbi.messaging.NormalizedMessageImpl@b125bd{properties
>> >> >> :
>> >> >> {}}
>> >> >> INFO  - SubscriberComponent            - Body is: <?xml
>> version="1.0
>> "
>> >> >> encoding="UTF-8"?><ns2:Notify xmlns:ns2="
>> >> >> http://docs.oasis-open.org/wsn/b-2"
>> >> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >> >>
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> >> >> Example
>> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> >> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>> >> >>
>> >> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
>> >> status
>> >> =
>> >> >> getStatus()
>> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA
>> LO
>> >> >> STATO
>> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> me.handleSend(sync)
>> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> container.sendExchange(mirror);
>> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> >> messageId
>> >> >> =
>> >> >> ID:martina-39597-1199704995676-3:0:1:1:6, originalDestination =
>> null,
>> >> >> originalTransactionId = null, producerId =
>> >> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
>> >> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
>> >> expiration
>> >> >> =
>> >> >> 0, timestamp = 1199705011183, arrival = 0, correlationId = null,
>> >> replyTo
>> >> >> =
>> >> >> null, persistent = true, type = null, priority = 4, groupID = null,
>> >> >> groupSequence = 0, targetConsumerId = null, compressed = false,
>> userID
>> >> =
>> >> >> null, content = org.apache.activemq.util.ByteSequence@c70f32,
>> >> >> marshalledProperties = null, dataStructure = null,
>> redeliveryCounter
>> =
>> >> 0,
>> >> >> size = 0, properties = null, readOnlyProperties = true,
>> readOnlyBody
>> =
>> >> >> true,
>> >> >> droppable = false}
>> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> container.sendExchange(mirror);
>> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> >> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> >> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
>> >> InOnly[
>> >> >>  id: ID:192.168.0.172-11753fdefba-2:0
>> >> >>  status: Done
>> >> >>  role: provider
>> >> >>  endpoint: endpoint
>> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >> >>
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> >> >> Example
>> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> >> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>> >> >>
>> >> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> >> ]
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
>> >> status
>> >> =
>> >> >> getStatus()
>> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA
>> LO
>> >> >> STATO
>> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> me.handleSend(sync)
>> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> DEBUG - WSNSpringComponent             - Received exchange: status:
>> >> Done,
>> >> >> role: consumer
>> >> >> DEBUG - WSNSpringComponent             - Retrieved correlation id:
>> >> null
>> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> >> messageId
>> >> >> =
>> >> >> ID:martina-39597-1199704995676-3:0:1:1:7, originalDestination =
>> null,
>> >> >> originalTransactionId = null, producerId =
>> >> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
>> >> >> queue://org.apache.servicemix.jms.{
>> >> >>
>> >>
>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> >> ,
>> >> >> transactionId = null, expiration = 0, timestamp = 1199705011188,
>> >> arrival
>> >> >> =
>> >> >> 0, correlationId = null, replyTo = null, persistent = true, type =
>> >> null,
>> >> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
>> >> null,
>> >> >> compressed = false, userID = null, content =
>> >> >> org.apache.activemq.util.ByteSequence@1c8f59c, marshalledProperties
>> =
>> >> >> null,
>> >> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
>> >> null,
>> >> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
>> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> container.sendExchange(mirror);
>> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> ERROR - JMSFlow                        - Caught an exception
>> routing
>> >> >> ExchangePacket:
>> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
>> >> sendSync
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> >> >> MessageExchangeImpl.java:581)
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>> >> >> DeliveryChannelImpl.java:384)
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> >> >> DeliveryChannelImpl.java:444)
>> >> >>        at
>> >> >>
>> >>
>> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
>> >> >> :249)
>> >> >>        at
>> >> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> >> >> SubscriberComponent.java:203)
>> >> >>        at
>> >> >>
>> >>
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> >> >> DeliveryChannelImpl.java:621)
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> >> >> AbstractFlow.java:174)
>> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
>> >> >> JMSFlow.java:1)
>> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>> >> >> JMSFlow.java:543)
>> >> >>        at
>> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> >> >> (ThreadPoolExecutor.java:665)
>> >> >>        at
>> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> >> >> (ThreadPoolExecutor.java:690)
>> >> >>        at java.lang.Thread.run(Thread.java:595)
>> >> >>
>> >> >> Can you help me again?
>> >> >> Thanks in advance!
>> >> >>
>> >> >> Martina
>> >> >>
>> >> >>
>> >> >>
>> >> >> gnodet wrote:
>> >> >> >
>> >> >> > You need to use an InOnly or RobustInOnly exchange, not an InOut
>> >> >> exchange,
>> >> >> > as notifications do not have any out messages.
>> >> >> >
>> >> >> > On Jan 4, 2008 5:16 PM, martymusk <ma...@email.it> wrote:
>> >> >> >
>> >> >> >>
>> >> >> >> Thus , I've created a new class "SubscriberComponent" that is a
>> >> copy
>> >> >> of
>> >> >> >> PublisherComponent. Trhough it instance2 receive exchange and
>> try
>> >> to
>> >> >> send
>> >> >> >> scambio (copy of exchange). When I run example the following
>> error
>> >> >> >> occurs...
>> >> >> >>
>> >> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> >> >> messageId
>> >> >> >> =
>> >> >> >> ID:martina-38529-1199462112612-3:0:1:1:6, originalDestination =
>> >> null,
>> >> >> >> originalTransactionId = null, producerId =
>> >> >> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
>> >> >> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
>> >> >> expiration
>> >> >> >> =
>> >> >> >> 0, timestamp = 1199462153935, arrival = 0, correlationId = null,
>> >> >> replyTo
>> >> >> >> =
>> >> >> >> null, persistent = true, type = null, priority = 4, groupID =
>> null,
>> >> >> >> groupSequence = 0, targetConsumerId = null, compressed = false,
>> >> userID
>> >> >> =
>> >> >> >> null, content = org.apache.activemq.util.ByteSequence@b2175,
>> >> >> >> marshalledProperties = null, dataStructure = null,
>> >> redeliveryCounter
>> >> =
>> >> >> 0,
>> >> >> >> size = 0, properties = null, readOnlyProperties = true,
>> >> readOnlyBody
>> >> =
>> >> >> >> true,
>> >> >> >> droppable = false}
>> >> >> >> DEBUG - WSNSpringComponent             - Received exchange:
>> status:
>> >> >> >> Active,
>> >> >> >> role: consumer
>> >> >> >> DEBUG - WSNSpringComponent             - Retrieved correlation
>> id:
>> >> >> null
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> >> container.sendExchange(mirror);
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> >> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> >> >> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> >> >> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO
>> E':
>> >> >> InOut[
>> >> >> >>  id: ID:192.168.0.172-1174583cdf9-2:0
>> >> >> >>  status: Active
>> >> >> >>  role: provider
>> >> >> >>  endpoint: endpoint
>> >> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> >> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >> >> >>
>> >> >>
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing
>> "><name>My
>> >> >> >> Example
>> >> >> >>
>> Job</name><group>ServiceMix</group><fullname>ServiceMix.MyExample
>> >> >> >> Job</fullname><description/><fireTime>Fri Jan 04 16:55:53 CET
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> >> >> ]
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
>> LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
>> >> >> status
>> >> >> =
>> >> >> >> getStatus()
>> >> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E
>> CAMBIA
>> >> LO
>> >> >> >> STATO
>> >> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> me.handleSend(sync)
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> >> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> >> >> messageId
>> >> >> >> =
>> >> >> >> ID:martina-38529-1199462112612-3:0:1:1:7, originalDestination =
>> >> null,
>> >> >> >> originalTransactionId = null, producerId =
>> >> >> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
>> >> >> >> queue://org.apache.servicemix.jms.{
>> >> >> >>
>> >> >>
>> >>
>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> >> >> ,
>> >> >> >> transactionId = null, expiration = 0, timestamp = 1199462153952,
>> >> >> arrival
>> >> >> >> =
>> >> >> >> 0, correlationId = null, replyTo = null, persistent = true, type
>> =
>> >> >> null,
>> >> >> >> priority = 4, groupID = null, groupSequence = 0,
>> targetConsumerId
>> =
>> >> >> null,
>> >> >> >> compressed = false, userID = null, content =
>> >> >> >> org.apache.activemq.util.ByteSequence@779b3e,
>> marshalledProperties
>> >> =
>> >> >> >> null,
>> >> >> >> dataStructure = null, redeliveryCounter = 0, size = 0,
>> properties
>> =
>> >> >> null,
>> >> >> >> readOnlyProperties = true, readOnlyBody = true, droppable =
>> false}
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> >> container.sendExchange(mirror);
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
>> LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
>> LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> ERROR - JMSFlow                        - Caught an exception
>> >> routing
>> >> >> >> ExchangePacket:
>> >> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
>> >> >> sendSync
>> >> >> >>        at
>> >> >> >>
>> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> >> >> >> MessageExchangeImpl.java:581)
>> >> >> >>        at
>> >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>> >> >> >> DeliveryChannelImpl.java:384)
>> >> >> >>        at
>> >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> >> >> >> DeliveryChannelImpl.java:444)
>> >> >> >>        at
>> >> >> >>
>> >> >>
>> >>
>> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
>> >> >> >> :249)
>> >> >> >>        at
>> >> >> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> >> >> >> SubscriberComponent.java:203)
>> >> >> >>        at
>> >> >> >>
>> >> >>
>> >>
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> >> >> >> DeliveryChannelImpl.java:621)
>> >> >> >>        at
>> >> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> >> >> >> AbstractFlow.java:174)
>> >> >> >>        at
>> org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3
>> (
>> >> >> >> JMSFlow.java:1)
>> >> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>> >> >> >> JMSFlow.java:543)
>> >> >> >>        at
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> >> >> >> (ThreadPoolExecutor.java:665)
>> >> >> >>        at
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> >> >> >> (ThreadPoolExecutor.java:690)
>> >> >> >>        at java.lang.Thread.run(Thread.java:595)
>> >> >> >>
>> >> >> >> I do wrong again?
>> >> >> >>
>> >> >> >> Thank you!!!
>> >> >> >> Martina
>> >> >> >>
>> >> >> >>
>> >> >> >> gnodet wrote:
>> >> >> >> >
>> >> >> >> > You should have a look at the existing code:
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/spring/PublisherComponent.java?r=602828
>> >> >> >> >
>> >> >> >> > Note that the publisher component actually use the client api
>> >> (line
>> >> >> >> 172).
>> >> >> >> > For details on thow the client api works (which is how to send
>> a
>> >> JBI
>> >> >> >> > exchange to the WSN broker), see:
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/client/NotificationBroker.java?r=602828#l89
>> >> >> >> >
>> >> >> >> > I would advise you to start from the publisher component, copy
>> it
>> >> >> and
>> >> >> >> use
>> >> >> >> > it
>> >> >> >> > instead of your TraceComponent.
>> >> >> >> > Each time it receives a JBI exchange, it will publish it
>> through
>> >> the
>> >> >> >> > WSNotification broker.
>> >> >> >> >
>> >> >> >> > Also look at the various resources on the web site that may
>> help
>> >> >> you:
>> >> >> >> >   http://servicemix.apache.org/servicemix-wsn2005.html
>> >> >> >> >   http://servicemix.apache.org/example-scenario.html
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > On Jan 4, 2008 2:58 PM, martymusk <ma...@email.it> wrote:
>> >> >> >> >
>> >> >> >> >>
>> >> >> >> >> Hy gnodet and thank you very much for your helpfulness,
>> >> >> >> >> but I don't understand exactly what I must to do.
>> >> >> >> >>
>> >> >> >> >> How can I send JBI exchange to the WSN broker directly?
>> >> >> >> >> How can I use WSN client api.
>> >> >> >> >>
>> >> >> >> >> I'm working for a thesis at University of Naples.
>> >> >> >> >> My purpose is to study WSN performance.
>> >> >> >> >> I've found your WSN implementation very useful for me, but to
>> >> study
>> >> >> >> >> performance, I need exchange was send back.
>> >> >> >> >> It is more than a mounth I'm triyng to do this.
>> >> >> >> >>
>> >> >> >> >> I would be very grateful if you can help me. Otherwise, there
>> >> are
>> >> >> no
>> >> >> >> >> problems, I'll keep on study over and over again, hoping I be
>> >> able
>> >> >> to
>> >> >> >> >> achieve my purpose.
>> >> >> >> >>
>> >> >> >> >> Thank you very much.
>> >> >> >> >> Martina
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> gnodet wrote:
>> >> >> >> >> >
>> >> >> >> >> > I thought I pointed you to the right direction.
>> >> >> >> >> > Do not use the PublisherComponent that way: either use it
>> as
>> >> it
>> >> >> is
>> >> >> >> >> > intended
>> >> >> >> >> > (deploy it as a component onto the lightweight container)
>> or
>> >> use
>> >> >> the
>> >> >> >> >> WSN
>> >> >> >> >> > client api:
>> >> >> >> >> >    wsn.notify(topic, msg)
>> >> >> >> >> >
>> >> >> >> >> > I'm not sure what you are trying to achieve with your
>> >> >> >> TraceComponent.
>> >> >> >> >>  It
>> >> >> >> >> > sounds like you want to reimplement the PublisherComponent.
>> >> If
>> >> >> so,
>> >> >> >> you
>> >> >> >> >> > should have a look at how it is implemented and patch it.
>> >> >> >> >> >
>> >> >> >> >> > Also note that both PublisherComponent and the WSN client
>> api
>> >> are
>> >> >> >> just
>> >> >> >> >> > sugar, you can send a JBI exchange to the WSN broker
>> directly
>> >> if
>> >> >> you
>> >> >> >> >> want.
>> >> >> >> >> >
>> >> >> >> >> > On Jan 4, 2008 2:13 PM, martymusk <ma...@email.it>
>> wrote:
>> >> >> >> >> >
>> >> >> >> >> >>
>> >> >> >> >> >> My problem is always the same!
>> >> >> >> >> >> In wsn-example, after Consumer received an exchange, I'd
>> like
>> >> it
>> >> >> >> send
>> >> >> >> >> >> copy
>> >> >> >> >> >> of it. But it doesn't happen. :-(
>> >> >> >> >> >> I've modified TraceComponent class in the following way,
>> but
>> >> it
>> >> >> >> >> doesn't
>> >> >> >> >> >> work
>> >> >> >> >> >> fine:
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >> package org.apache.servicemix.wsn;
>> >> >> >> >> >>
>> >> >> >> >> >> import java.io.StringWriter;
>> >> >> >> >> >>
>> >> >> >> >> >> import javax.jbi.JBIException;
>> >> >> >> >> >> import javax.jbi.messaging.ExchangeStatus;
>> >> >> >> >> >> import javax.jbi.messaging.MessageExchange;
>> >> >> >> >> >> import javax.jbi.messaging.MessagingException;
>> >> >> >> >> >> import javax.jbi.messaging.NormalizedMessage;
>> >> >> >> >> >> import javax.xml.bind.JAXBContext;
>> >> >> >> >> >> import javax.xml.transform.Source;
>> >> >> >> >> >> import javax.xml.transform.TransformerException;
>> >> >> >> >> >> //import javax.jbi.messaging.InOut;
>> >> >> >> >> >>
>> >> >> >> >> >> import
>> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl
>> >> ;
>> >> >> >> >> >> import org.apache.servicemix.jbi.messaging.InOutImpl;
>> >> >> >> >> >> import org.apache.commons.logging.Log;
>> >> >> >> >> >> import org.apache.commons.logging.LogFactory;
>> >> >> >> >> >> import org.apache.servicemix.MessageExchangeListener;
>> >> >> >> >> >> import
>> >> org.apache.servicemix.components.util.ComponentSupport;
>> >> >> >> >> >> import
>> org.apache.servicemix.wsn.spring.PublisherComponent;
>> >> >> >> >> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
>> >> >> >> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
>> >> >> >> >> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
>> >> >> >> >> >> import
>> org.apache.servicemix.wsn.client.NotificationBroker;
>> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
>> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
>> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
>> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
>> >> >> >> >> >> import org.w3c.dom.Element;
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >> public class TraceComponent extends ComponentSupport
>> >> implements
>> >> >> >> >> >>                MessageExchangeListener {
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>        private Log log =
>> >> >> LogFactory.getLog(TraceComponent.class);
>> >> >> >> >> >>
>> >> >> >> >> >>        private SourceTransformer sourceTransformer = new
>> >> >> >> >> >> SourceTransformer();
>> >> >> >> >> >>
>> >> >> >> >> >>        public Log getLog() {
>> >> >> >> >> >>                return log;
>> >> >> >> >> >>        }
>> >> >> >> >> >>
>> >> >> >> >> >>        public void setLog(Log log) {
>> >> >> >> >> >>                this.log = log;
>> >> >> >> >> >>        }
>> >> >> >> >> >>
>> >> >> >> >> >>        public SourceTransformer getSourceTransformer() {
>> >> >> >> >> >>                return sourceTransformer;
>> >> >> >> >> >>        }
>> >> >> >> >> >>
>> >> >> >> >> >>        public void setSourceTransformer(SourceTransformer
>> >> >> >> >> >> sourceTransformer) {
>> >> >> >> >> >>                this.sourceTransformer = sourceTransformer;
>> >> >> >> >> >>        }
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>        //AGGIUNGO CODICE
>> >> >> >> >> >>
>> >> >> >> >> >>        PublisherComponent publisher = new
>> >> PublisherComponent();
>> >> >> >> >> >>          private String subscriptionEndpoint =
>> >> "subscription";
>> >> >> >> >> >>          private NotificationBroker wsnBroker;
>> >> >> >> >> >>          private String topic;
>> >> >> >> >> >>          private String msg;
>> >> >> >> >> >>          private boolean demand;
>> >> >> >> >> >>          private Subscribe subscription;
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>          public String getTopic() {
>> >> >> >> >> >>                return topic;
>> >> >> >> >> >>            }
>> >> >> >> >> >>
>> >> >> >> >> >>            /**
>> >> >> >> >> >>             * @param topic The topic to set.
>> >> >> >> >> >>             */
>> >> >> >> >> >>            public void setTopic(String topic) {
>> >> >> >> >> >>               this.topic = topic;
>> >> >> >> >> >>            }
>> >> >> >> >> >>
>> >> >> >> >> >>         public void init() throws JBIException {
>> >> >> >> >> >>                super.init();
>> >> >> >> >> >>                getContext().activateEndpoint(getService(),
>> >> >> >> >> >> subscriptionEndpoint);
>> >> >> >> >> >>                 log.info("METODO INIT");
>> >> >> >> >> >>                // publisher.init();
>> >> >> >> >> >>
>> >> >> >> >> >>                 publisher.setTopic(topic);
>> >> >> >> >> >>            }
>> >> >> >> >> >>
>> >> >> >> >> >>            /* (non-Javadoc)
>> >> >> >> >> >>             * @see
>> >> javax.jbi.management.LifeCycleMBean#start()
>> >> >> >> >> >>             */
>> >> >> >> >> >>            public void start() throws JBIException {
>> >> >> >> >> >>
>> >> >> >> >> >>                log.info("METODO START");
>> >> >> >> >> >>                //publisher.start();
>> >> >> >> >> >>                new Thread() {
>> >> >> >> >> >>                  public void run() {
>> >> >> >> >> >>                       try {
>> >> >> >> >> >>                           wsnBroker = new
>> >> >> >> >> >> NotificationBroker(getContext());
>> >> >> >> >> >>
>> >> >> >> >> >>                           String wsaAddress =
>> >> >> >> >> >> getService().getNamespaceURI() + "/"
>> >> >> >> >> >> + getService().getLocalPart() + "/" +
>> subscriptionEndpoint;
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >>
>> >> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
>> >> >> >> >> >>
>> topic,
>> >> >> >> >> >>
>> >>  demand);
>> >> >> >> >> >>                        } catch (Exception e) {
>> >> >> >> >> >>                            log.error("Could not create wsn
>> >> >> client",
>> >> >> >> >> e);
>> >> >> >> >> >>                        }
>> >> >> >> >> >>                    }
>> >> >> >> >> >>                }.start();
>> >> >> >> >> >>            }
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>            public void shutDown() throws JBIException {
>> >> >> >> >> >>                log.info("METODO SHUTDOWN");
>> >> >> >> >> >>            //  publisher.shutDown();
>> >> >> >> >> >>               super.shutDown();
>> >> >> >> >> >>            }
>> >> >> >> >> >>
>> >> >> >> >> >>            //FINE CODICE AGGIUNTO
>> >> >> >> >> >>
>> >> >> >> >> >>        public void onMessageExchange(MessageExchange
>> >> exchange)
>> >> >> >> >> >>                        throws MessagingException {
>> >> >> >> >> >>                // lets dump the incoming message
>> >> >> >> >> >>                NormalizedMessage message =
>> >> exchange.getMessage
>> >> >> >> ("in");
>> >> >> >> >> >>                if (message == null) {
>> >> >> >> >> >>                        log.warn("Received null message
>> from
>> >> >> >> exchange:
>> >> >> >> >> "
>> >> >> >> >> +
>> >> >> >> >> >> exchange);
>> >> >> >> >> >>                } else {
>> >> >> >> >> >>                        log.info("Exchange: " + exchange +
>> "
>> >> >> >> received
>> >> >> >> >> IN
>> >> >> >> >> >> message: "
>> >> >> >> >> >>                                        + message);
>> >> >> >> >> >>                        try {
>> >> >> >> >> >>                                log.info("Body is: "
>> >> >> >> >> >>                                                +
>> >> >> >> >> >> sourceTransformer.toString(message.getContent()));
>> >> >> >> >> >>                        } catch (TransformerException e) {
>> >> >> >> >> >>                                log.error("Failed to turn
>> >> message
>> >> >> >> body
>> >> >> >> >> >> into
>> >> >> >> >> >> text: " + e, e);
>> >> >> >> >> >>                        }
>> >> >> >> >> >>                }
>> >> >> >> >> >>                done(exchange);
>> >> >> >> >> >>                log.info("MESSAGGIO RICEVUTO");
>> >> >> >> >> >>
>> >> >> >> >> >>                log.info("COPIO IL PACCHETTO");
>> >> >> >> >> >>
>> >> >> >> >> >>                MessageExchange scambio =
>> >> >> (MessageExchange)exchange;
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>                log.info("INVIO");
>> >> >> >> >> >>
>> >> >> >> >> >>          try{
>> >> >> >> >> >>
>> >> >> >> >> >>                log.info("FASE INVIO");
>> >> >> >> >> >>                //publisher.onMessageExchange(scambio);
>> >> >> >> >> >>
>> >> >> >> >> >>                //AGGIUNGO onMessageExchange
>> >> >> >> >> >>
>> >> >> >> >> >>                if (exchange.getStatus() !=
>> >> >> ExchangeStatus.ACTIVE)
>> >> >> {
>> >> >> >> >> >>                    return;
>> >> >> >> >> >>                }
>> >> >> >> >> >>                // This is a notification from the WSN
>> broker
>> >> >> >> >> >>                if
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
>> >> >> >> >> {
>> >> >> >> >> >>                    try {
>> >> >> >> >> >>                        JAXBContext jaxbContext =
>> >> >> >> >> >> JAXBContext.newInstance(Subscribe.class);
>> >> >> >> >> >>                        Source src = exchange.getMessage
>> >> >> >> >> >> ("in").getContent();
>> >> >> >> >> >>                        Object input =
>> >> >> >> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
>> >> >> >> >> >>                        if (input instanceof Subscribe) {
>> >> >> >> >> >>                            subscription = (Subscribe)
>> input;
>> >> >> >> >> >>                            SubscribeResponse response =
>> new
>> >> >> >> >> >> SubscribeResponse();
>> >> >> >> >> >>                            String wsaAddress =
>> >> >> >> >> >> getService().getNamespaceURI() +
>> >> >> >> >> >> "/" + getService().getLocalPart() + "/" +
>> >> subscriptionEndpoint;
>> >> >> >> >> >>
>> >> >> >> >> >> response.setSubscriptionReference(
>> AbstractWSAClient.createWSA
>> >> >> >> >> >> (wsaAddress));
>> >> >> >> >> >>                            StringWriter writer = new
>> >> >> >> StringWriter();
>> >> >> >> >> >>                            jaxbContext.createMarshaller
>> >> >> >> >> >> ().marshal(response,
>> >> >> >> >> >> writer);
>> >> >> >> >> >>                            NormalizedMessage out =
>> >> >> >> >> exchange.createMessage
>> >> >> >> >> >> ();
>> >> >> >> >> >>                            out.setContent(new
>> >> >> >> >> >> StringSource(writer.toString
>> >> >> >> >> >> ()));
>> >> >> >> >> >>                            exchange.setMessage(out,
>> "out");
>> >> >> >> >> >>                            send(exchange);
>> >> >> >> >> >>
>> >> >> >> >> >>                        } else if (input instanceof
>> >> Unsubscribe)
>> >> >> {
>> >> >> >> >> >>                            subscription = null;
>> >> >> >> >> >>                            UnsubscribeResponse response =
>> new
>> >> >> >> >> >> UnsubscribeResponse();
>> >> >> >> >> >>                            StringWriter writer = new
>> >> >> >> StringWriter();
>> >> >> >> >> >>                            jaxbContext.createMarshaller
>> >> >> >> >> >> ().marshal(response,
>> >> >> >> >> >> writer);
>> >> >> >> >> >>                            NormalizedMessage out =
>> >> >> >> >> exchange.createMessage
>> >> >> >> >> >> ();
>> >> >> >> >> >>                            out.setContent(new
>> >> >> >> >> >> StringSource(writer.toString
>> >> >> >> >> >> ()));
>> >> >> >> >> >>                            exchange.setMessage(out,
>> "out");
>> >> >> >> >> >>                            send(exchange);
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>                        } else {
>> >> >> >> >> >>                            throw new Exception("Unkown
>> >> >> request");
>> >> >> >> >> >>                        }
>> >> >> >> >> >>                    } catch (Exception e) {
>> >> >> >> >> >>                        fail(exchange, e);
>> >> >> >> >> >>                    }
>> >> >> >> >> >>                // This is a notification to publish
>> >> >> >> >> >>                }
>> >> >> >> >> >>
>> >> >> >> >> >>                  else {
>> >> >> >> >> >>                    try {
>> >> >> >> >> >>
>> >> >> >> >> >>                    log.info("SALTA");
>> >> >> >> >> >>                        if (!demand || subscription !=
>> null)
>> {
>> >> >> >> >> >>                                log.info("ENTRO NELL'IF");
>> >> >> >> >> >>                           // Element elem = new
>> >> >> >> >> >> SourceTransformer().toDOMElement(exchange.getMessage
>> ("in"));
>> >> >> >> >> >>                            log.info("PRIMA DI WSNBROKER");
>> >> >> >> >> >>                            wsnBroker.notify(topic, msg);
>> >> >> >> >> >>                            log.info("PRIMA DI DONE");
>> >> >> >> >> >>
>> >>  getDeliveryChannel().send(exchange);
>> >> >> >> >> >>                            log.info("DOPO DI DONE");
>> >> >> >> >> >>                        } else {
>> >> >> >> >> >>                            log.info("Ingore notification
>> as
>> >> the
>> >> >> >> >> publisher
>> >> >> >> >> >> is no
>> >> >> >> >> >> subscribers");
>> >> >> >> >> >>                        }
>> >> >> >> >> >>                    } catch (Exception e) {
>> >> >> >> >> >>                        fail(exchange, e);
>> >> >> >> >> >>                        }
>> >> >> >> >> >>
>> >> >> >> >> >>                log.debug("IL PACCHETTO INVIATO E': " +
>> >> scambio);
>> >> >> >> >> >>
>> >> >> >> >> >>                  }
>> >> >> >> >> >>                //FINE onMessageExchange
>> >> >> >> >> >>
>> >> >> >> >> >>           } catch(JBIException e){
>> >> >> >> >> >>                  log.error("ECCEZIONE GENERATA!");
>> >> >> >> >> >>          }
>> >> >> >> >> >>
>> >> >> >> >> >>      log.info("INVIATO");
>> >> >> >> >> >> }
>> >> >> >> >> >> }
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >> Help me if you can.
>> >> >> >> >> >> Thank you very much for your helpfulness...
>> >> >> >> >> >>
>> >> >> >> >> >> Martina
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >> gnodet wrote:
>> >> >> >> >> >> >
>> >> >> >> >> >> > You should not have to deal nor see the internal state
>> of
>> >> the
>> >> >> >> >> exchange.
>> >> >> >> >> >> > If guess you have an exception when trying to send an
>> >> >> exchange,
>> >> >> >> but
>> >> >> >> >> >> this
>> >> >> >> >> >> > means that there is a problem in your code.  You should
>> >> post
>> >> a
>> >> >> >> >> snippet
>> >> >> >> >> >> of
>> >> >> >> >> >> > your code that is failing so that we can help you.
>> >> >> >> >> >> >
>> >> >> >> >> >> > On Jan 4, 2008 12:22 PM, martymusk <ma...@email.it>
>> >> wrote:
>> >> >> >> >> >> >
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> Hy,
>> >> >> >> >> >> >> I've a question...
>> >> >> >> >> >> >> can I set anywhere Consumer to CAN_SEND?
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> I hope you can help me.
>> >> >> >> >> >> >> Thank you in advance.
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> Martina
>> >> >> >> >> >> >> --
>> >> >> >> >> >> >> View this message in context:
>> >> >> >> >> >> >>
>> >> >> >> >>
>> >> >>
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
>> >> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> >> >> >> Nabble.com.
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >
>> >> >> >> >> >> >
>> >> >> >> >> >> > --
>> >> >> >> >> >> > Cheers,
>> >> >> >> >> >> > Guillaume Nodet
>> >> >> >> >> >> > ------------------------
>> >> >> >> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >> >> >> >
>> >> >> >> >> >> >
>> >> >> >> >> >>
>> >> >> >> >> >> --
>> >> >> >> >> >> View this message in context:
>> >> >> >> >> >>
>> >> >> >>
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616107.html
>> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> >> >> Nabble.com.
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > --
>> >> >> >> >> > Cheers,
>> >> >> >> >> > Guillaume Nodet
>> >> >> >> >> > ------------------------
>> >> >> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >>
>> >> >> >> >> --
>> >> >> >> >> View this message in context:
>> >> >> >> >>
>> >> >>
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616748.html
>> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> >> Nabble.com.
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > --
>> >> >> >> > Cheers,
>> >> >> >> > Guillaume Nodet
>> >> >> >> > ------------------------
>> >> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >> --
>> >> >> >> View this message in context:
>> >> >> >>
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14619757.html
>> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> Nabble.com.
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > Cheers,
>> >> >> > Guillaume Nodet
>> >> >> > ------------------------
>> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14663812.html
>> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > Cheers,
>> >> > Guillaume Nodet
>> >> > ------------------------
>> >> > Blog: http://gnodet.blogspot.com/
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14664874.html
>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> > Cheers,
>> > Guillaume Nodet
>> > ------------------------
>> > Blog: http://gnodet.blogspot.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14665988.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14692598.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Consumer Can Send

Posted by martymusk <ma...@email.it>.
Hy Guillame, 
thank you very much for help you give me.

Can i post you another question?
What is size of message sended?
Can I obtain it?
I need it to do some test.
Can you help me please?

Thank you in advance.
Martina



gnodet wrote:
> 
> What are these timestamps used for ?
> You can query the status / role on the jbi exchange itself ...
> 
> On Jan 10, 2008 11:02 AM, martymusk <ma...@email.it> wrote:
> 
>>
>> Ok Guillame, I've understood. Thank you very much.
>>
>> So consumer send exchange through wsn-client api, but where provider
>> receive
>> it?
>>
>> I must introduce 4 timestamps, exactly when:
>>   1)consumer send exchange
>>   2)provider receive exchange
>>   3)provider send exchange
>>   4)consumer receive exchange
>>
>> Now, 1) and 3) timestamps have to be introduced before wsn-client api,
>> it's
>> right?
>> But where I must introduce 2) and 4) timestamps?
>>
>> I hope you can help me!
>> Thank you very much in advance.
>>
>> Martina
>>
>>
>>
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14797295.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Consumer Can Send

Posted by Guillaume Nodet <gn...@gmail.com>.
What are these timestamps used for ?
You can query the status / role on the jbi exchange itself ...

On Jan 10, 2008 11:02 AM, martymusk <ma...@email.it> wrote:

>
> Ok Guillame, I've understood. Thank you very much.
>
> So consumer send exchange through wsn-client api, but where provider
> receive
> it?
>
> I must introduce 4 timestamps, exactly when:
>   1)consumer send exchange
>   2)provider receive exchange
>   3)provider send exchange
>   4)consumer receive exchange
>
> Now, 1) and 3) timestamps have to be introduced before wsn-client api,
> it's
> right?
> But where I must introduce 2) and 4) timestamps?
>
> I hope you can help me!
> Thank you very much in advance.
>
> Martina
>
>
>

-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: Consumer Can Send

Posted by martymusk <ma...@email.it>.
Ok Guillame, I've understood. Thank you very much.

So consumer send exchange through wsn-client api, but where provider receive
it?

I must introduce 4 timestamps, exactly when:
   1)consumer send exchange
   2)provider receive exchange
   3)provider send exchange
   4)consumer receive exchange

Now, 1) and 3) timestamps have to be introduced before wsn-client api, it's
right?
But where I must introduce 2) and 4) timestamps?

I hope you can help me!
Thank you very much in advance.

Martina



gnodet wrote:
> 
> This is done by the WS-Notification client api, which in turns use the
> ServiceMixClient interface.  So the actual exchange creation is a bit
> hidden.
> 
> 
> On Jan 9, 2008 5:56 PM, martymusk <ma...@email.it> wrote:
> 
>>
>>  Please gnodet,
>> I've a doubt in my mind...
>>
>> Can you point me  where consumer creates exchange and call send?
>> This is the first step of exchange beetwen components, it's right?
>>
>> But what is the snippet code that make this?
>> In PublisherComponent class?
>> I'm unable to identify it.
>>
>> Can you help me, please?
>> Thanks in advance
>>
>> Martina
>>
>>
>>
>>
>>
>>
>> gnodet wrote:
>> >
>> > You need to understand how exchanges are sent between components.
>> > For a simple InOnly exchange, it will be the following:
>> >    * consumer create the exchange and call send
>> >    * provider receives the exchange (possibly in onMessageExchange)
>> >    * provide set the done status and call send
>> >    * consumer receives the exchange in a DONE status
>> >
>> > In your case, the PublisherComponent acts both as a consumer and a
>> > provider,
>> > because it receives an exchange and send a copy to the broker, so the
>> > onMessageExchange will be called multiple times:
>> >    * first when it receives the first exchange and acts as the provider
>> > (it
>> > creates a new exchange and send it by using the WSNotification client
>> api)
>> >    * then when the exchange comes back with a DONE status
>> >
>> > The log you pasted below is fine but is the second call to the method
>> (you
>> > can see the DONE status and even the content of the exchange that has
>> been
>> > previously sent).  Check earlier in your log and you will find what you
>> > need.
>> >
>> > On Jan 7, 2008 2:39 PM, martymusk <ma...@email.it> wrote:
>> >
>> >>
>> >> I've tried with original code, and it returns because status is DONE.
>> >> I post output obtained with original code:
>> >>
>> >> DEBUG - WSNSpringComponent             - Received exchange: status:
>> Done,
>> >> role: consumer
>> >> DEBUG - WSNSpringComponent             - Retrieved correlation id:
>> null
>> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> container.sendExchange(mirror);
>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
>> InOnly[
>> >>  id: ID:192.168.0.172-1175476963a-2:0
>> >>  status: Done
>> >>  role: provider
>> >>  endpoint: endpoint
>> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> >> Example
>> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> >> Job</fullname><description/><fireTime>Mon Jan 07 14:35:12 CET
>> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> ]
>> >> INFO  - SubscriberComponent            - RETURNS BECAUSE STATUS IS:
>> Done
>> >>
>> >> So I've tried to modify ACTIVE with DONE, hoping it carry on, but it
>> >> fails
>> >> with error I've posted previously.
>> >>
>> >> I don't understand what I do wrong!
>> >> It's more than a mounth I'm trying to return back exchange. :-(
>> >>
>> >> Thank you very much for help you give me!
>> >>
>> >> Martina
>> >>
>> >>
>> >>
>> >> gnodet wrote:
>> >> >
>> >> > Have you tried with the original code before modifying the class
>> from
>> >> > ServiceMix ?
>> >> > The first lines of the SubscriberComponent#onMessageExchange are
>> >> >
>> >> >  if (exchange.getStatus() != ExchangeStatus.ACTIVE) {
>> >> >      return;
>> >> >  }
>> >> >
>> >> > This is because you have to ignore exchanges in an Error / Done
>> status.
>> >> > From the code you pasted, it seems you removed those lines and
>> instead
>> >> do
>> >> > some copy work and call done() which will fail for exchanges that
>> are
>> >> not
>> >> > active.
>> >> >
>> >> > You can add debugging statements if you need (debug remoting works
>> fine
>> >> > too), but please try with the original code first.
>> >> >
>> >> > On Jan 7, 2008 1:52 PM, martymusk <ma...@email.it> wrote:
>> >> >
>> >> >>
>> >> >> Thank you very much...
>> >> >> The exception is the same, I post it:
>> >> >>
>> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> >> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> >> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
>> >> InOnly[
>> >> >>  id: ID:192.168.0.172-11754495367-2:0
>> >> >>  status: Done
>> >> >>  role: provider
>> >> >>  endpoint: endpoint
>> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >> >>
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> >> >> Example
>> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> >> >> Job</fullname><description/><fireTime>Mon Jan 07 13:46:56 CET
>> >> >>
>> >> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> >> ]
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
>> >> status
>> >> =
>> >> >> getStatus()
>> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA
>> LO
>> >> >> STATO
>> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> me.handleSend(sync)
>> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> >> messageId
>> >> >> =
>> >> >> ID:martina-39867-1199709997721-3:0:1:1:7, originalDestination =
>> null,
>> >> >> originalTransactionId = null, producerId =
>> >> >> ID:martina-39867-1199709997721-3:0:1:1, destination =
>> >> >> queue://org.apache.servicemix.jms.{
>> >> >>
>> >>
>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> >> ,
>> >> >> transactionId = null, expiration = 0, timestamp = 1199710016807,
>> >> arrival
>> >> >> =
>> >> >> 0, correlationId = null, replyTo = null, persistent = true, type =
>> >> null,
>> >> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
>> >> null,
>> >> >> compressed = false, userID = null, content =
>> >> >> org.apache.activemq.util.ByteSequence@5ac5f, marshalledProperties =
>> >> null,
>> >> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
>> >> null,
>> >> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
>> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> container.sendExchange(mirror);
>> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> ERROR - JMSFlow                        - Caught an exception
>> routing
>> >> >> ExchangePacket:
>> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
>> >> sendSync
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> >> >> MessageExchangeImpl.java:581)
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>> >> >> DeliveryChannelImpl.java:384)
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> >> >> DeliveryChannelImpl.java:444)
>> >> >>        at
>> >> >>
>> >>
>> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
>> >> >> :249)
>> >> >>        at
>> >> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> >> >> SubscriberComponent.java:204)
>> >> >>        at
>> >> >>
>> >>
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> >> >> DeliveryChannelImpl.java:621)
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> >> >> AbstractFlow.java:174)
>> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
>> >> >> JMSFlow.java:1)
>> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>> >> >> JMSFlow.java:543)
>> >> >>        at
>> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> >> >> (ThreadPoolExecutor.java:665)
>> >> >>        at
>> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> >> >> (ThreadPoolExecutor.java:690)
>> >> >>        at java.lang.Thread.run(Thread.java:595)
>> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
>> >> sendSync
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> >> >> MessageExchangeImpl.java:581)
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>> >> >> DeliveryChannelImpl.java:384)
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> >> >> DeliveryChannelImpl.java:444)
>> >> >>        at
>> >> >>
>> >>
>> org.apache.servicemix.components.util.PojoSupport.done(PojoSupport.java
>> >> >> :193)
>> >> >>        at
>> >> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> >> >> SubscriberComponent.java:198)
>> >> >>        at
>> >> >>
>> >>
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> >> >> DeliveryChannelImpl.java:621)
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> >> >> AbstractFlow.java:174)
>> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
>> >> >> JMSFlow.java:1)
>> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>> >> >> JMSFlow.java:543)
>> >> >>        at
>> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> >> >> (ThreadPoolExecutor.java:665)
>> >> >>        at
>> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> >> >> (ThreadPoolExecutor.java:690)
>> >> >>        at java.lang.Thread.run(Thread.java:595)
>> >> >>
>> >> >> What do I do wrong?
>> >> >> Thanks in advance!
>> >> >>
>> >> >> Martina
>> >> >>
>> >> >>
>> >> >> gnodet wrote:
>> >> >> >
>> >> >> > Just before calling fail(exchange, e), could you display the
>> stack
>> >> >> trace
>> >> >> > of
>> >> >> > the exception ?
>> >> >> >    e.printStackTrace()
>> >> >> > and send this error ?
>> >> >> > This is the real error, but it seems to be hidden by fail()
>> throwing
>> >> >> > another
>> >> >> > excepiton.
>> >> >> >
>> >> >> > On Jan 7, 2008 12:32 PM, martymusk <ma...@email.it> wrote:
>> >> >> >
>> >> >> >>
>> >> >> >> Hy gnodet,
>> >> >> >> thank you for your felpfulness.
>> >> >> >> Thus, I've used InOnly exchange, but I've the same error.
>> >> >> >> I post you my class and the error.
>> >> >> >>
>> >> >> >> package org.apache.servicemix.wsn;
>> >> >> >>
>> >> >> >>
>> >> >> >> import java.io.StringWriter;
>> >> >> >>
>> >> >> >> import javax.jbi.JBIException;
>> >> >> >> import javax.jbi.messaging.ExchangeStatus;
>> >> >> >> import javax.jbi.messaging.MessageExchange;
>> >> >> >> import javax.jbi.messaging.MessagingException;
>> >> >> >> import javax.jbi.messaging.NormalizedMessage;
>> >> >> >> import javax.xml.bind.JAXBContext;
>> >> >> >> import javax.xml.transform.Source;
>> >> >> >> import javax.xml.transform.TransformerException;
>> >> >> >>
>> >> >> >> import org.apache.commons.logging.Log;
>> >> >> >> import org.apache.commons.logging.LogFactory;
>> >> >> >> import org.apache.servicemix.MessageExchangeListener;
>> >> >> >> import org.apache.servicemix.components.util.ComponentSupport;
>> >> >> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
>> >> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
>> >> >> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
>> >> >> >> import org.apache.servicemix.wsn.client.NotificationBroker;
>> >> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
>> >> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
>> >> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
>> >> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
>> >> >> >> import org.w3c.dom.Element;
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>  public class SubscriberComponent extends ComponentSupport
>> >> implements
>> >> >> >> MessageExchangeListener {
>> >> >> >>
>> >> >> >>            private static final Log log =
>> >> >> >> LogFactory.getLog(SubscriberComponent.class);
>> >> >> >>
>> >> >> >>            private NotificationBroker wsnBroker;
>> >> >> >>            private String receiveTopic;
>> >> >> >>            private boolean demand;
>> >> >> >>            private String subscriptionEndpoint = "subscription";
>> >> >> >>            private Subscribe subscription;
>> >> >> >>
>> >> >> >>            /**
>> >> >> >>             * @return Returns the demand.
>> >> >> >>             */
>> >> >> >>            public boolean getDemand() {
>> >> >> >>                return demand;
>> >> >> >>            }
>> >> >> >>
>> >> >> >>            /**
>> >> >> >>             * @param demand The demand to set.
>> >> >> >>             */
>> >> >> >>            public void setDemand(boolean demand) {
>> >> >> >>                this.demand = demand;
>> >> >> >>            }
>> >> >> >>
>> >> >> >>            /**
>> >> >> >>             * @return Returns the topic.
>> >> >> >>             */
>> >> >> >>            public String getTopic() {
>> >> >> >>                return receiveTopic;
>> >> >> >>            }
>> >> >> >>
>> >> >> >>            /**
>> >> >> >>             * @param topic The topic to set.
>> >> >> >>             */
>> >> >> >>            public void setTopic(String receiveTopic) {
>> >> >> >>                this.receiveTopic = receiveTopic;
>> >> >> >>            }
>> >> >> >>
>> >> >> >>            /**
>> >> >> >>             * @return Returns the subscription.
>> >> >> >>             */
>> >> >> >>            public Subscribe getSubscription() {
>> >> >> >>                return subscription;
>> >> >> >>            }
>> >> >> >>
>> >> >> >>            /* (non-Javadoc)
>> >> >> >>             * @see
>> >> >> >> org.apache.servicemix.jbi.management.BaseLifeCycle#init
>> >> >> >> ()
>> >> >> >>             */
>> >> >> >>            public void init() throws JBIException {
>> >> >> >>                super.init();
>> >> >> >>                getContext().activateEndpoint(getService(),
>> >> >> >> subscriptionEndpoint);
>> >> >> >>            }
>> >> >> >>
>> >> >> >>            /* (non-Javadoc)
>> >> >> >>             * @see javax.jbi.management.LifeCycleMBean#start()
>> >> >> >>             */
>> >> >> >>            public void start() throws JBIException {
>> >> >> >>                new Thread() {
>> >> >> >>                    public void run() {
>> >> >> >>                        try {
>> >> >> >>                            wsnBroker = new
>> >> >> >> NotificationBroker(getContext());
>> >> >> >>                            String wsaAddress =
>> >> >> >> getService().getNamespaceURI() +
>> >> >> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>> >> >> >>
>> >> >> >>
>> >> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
>> >> >> >>
>> >> receiveTopic,
>> >> >> >>                                                        demand);
>> >> >> >>                        } catch (Exception e) {
>> >> >> >>                            log.error("Could not create wsn
>> client",
>> >> >> e);
>> >> >> >>                        }
>> >> >> >>                    }
>> >> >> >>                }.start();
>> >> >> >>            }
>> >> >> >>
>> >> >> >>
>> >> >> >>            private SourceTransformer sourceTransformer = new
>> >> >> >> SourceTransformer();
>> >> >> >>
>> >> >> >>            public SourceTransformer getSourceTransformer() {
>> >> >> >>                        return sourceTransformer;
>> >> >> >>                }
>> >> >> >>
>> >> >> >>                public void
>> setSourceTransformer(SourceTransformer
>> >> >> >> sourceTransformer) {
>> >> >> >>                        this.sourceTransformer =
>> sourceTransformer;
>> >> >> >>                }
>> >> >> >>
>> >> >> >>            /* (non-Javadoc)
>> >> >> >>             * @see
>> javax.jbi.management.LifeCycleMBean#shutDown()
>> >> >> >>             */
>> >> >> >>            public void shutDown() throws JBIException {
>> >> >> >>                super.shutDown();
>> >> >> >>            }
>> >> >> >>
>> >> >> >>            /* (non-Javadoc)
>> >> >> >>             * @see
>> >> >> >> org.apache.servicemix.MessageExchangeListener#onMessageExchange(
>> >> >> >> javax.jbi.messaging.MessageExchange)
>> >> >> >>             */
>> >> >> >>            public void onMessageExchange(MessageExchange
>> exchange)
>> >> >> throws
>> >> >> >> MessagingException {
>> >> >> >>
>> >> >> >>                NormalizedMessage message = exchange.getMessage
>> >> ("in");
>> >> >> >>                        if (message == null) {
>> >> >> >>                                log.warn("Received null message
>> from
>> >> >> >> exchange: " + exchange);
>> >> >> >>                        } else {
>> >> >> >>                                log.info("Exchange: " + exchange
>> +
>> "
>> >> >> >> received IN message: "
>> >> >> >>                                                + message);
>> >> >> >>                                try {
>> >> >> >>                                        log.info("Body is: "
>> >> >> >>                                                        +
>> >> >> >> sourceTransformer.toString(message.getContent()));
>> >> >> >>                                } catch (TransformerException e)
>> {
>> >> >> >>                                        log.error("Failed to turn
>> >> >> message
>> >> >> >> body into text: " + e, e);
>> >> >> >>                                }
>> >> >> >>                        }
>> >> >> >>                        done(exchange);
>> >> >> >>                        log.info("MESSAGGIO RICEVUTO");
>> >> >> >>
>> >> >> >>                  log.info("COPIO IL PACCHETTO");
>> >> >> >>
>> >> >> >>                        MessageExchange scambio =
>> >> >> >> (MessageExchange)exchange;
>> >> >> >>                        log.info("IL PACCHETTO COPIATO E': "
>> >> +scambio);
>> >> >> >>
>> >> >> >>
>> >> >> >>                if (exchange.getStatus() != ExchangeStatus.DONE)
>> {
>> >> >> >>                        log.info("RITORNA PERCHE' LO STATO E': "
>> >> >> >> +exchange.getStatus());
>> >> >> >>                    return;
>> >> >> >>                }
>> >> >> >>                // This is a notification from the WSN broker
>> >> >> >>                if
>> >> >> >>
>> >> >>
>> >>
>> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
>> >> >> {
>> >> >> >>                    try {
>> >> >> >>                        JAXBContext jaxbContext =
>> >> >> >> JAXBContext.newInstance(Subscribe.class);
>> >> >> >>                        Source src = exchange.getMessage
>> >> >> >> ("in").getContent();
>> >> >> >>                        Object input =
>> >> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
>> >> >> >>                        if (input instanceof Subscribe) {
>> >> >> >>                            subscription = (Subscribe) input;
>> >> >> >>                            SubscribeResponse response = new
>> >> >> >> SubscribeResponse();
>> >> >> >>                            String wsaAddress =
>> >> >> >> getService().getNamespaceURI() +
>> >> >> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>> >> >> >>
>> >> >> >> response.setSubscriptionReference(AbstractWSAClient.createWSA
>> >> >> >> (wsaAddress));
>> >> >> >>                            StringWriter writer = new
>> >> StringWriter();
>> >> >> >>                            jaxbContext.createMarshaller
>> >> >> >> ().marshal(response,
>> >> >> >> writer);
>> >> >> >>                            NormalizedMessage out =
>> >> >> exchange.createMessage
>> >> >> >> ();
>> >> >> >>                            out.setContent(new
>> >> >> >> StringSource(writer.toString
>> >> >> >> ()));
>> >> >> >>                            exchange.setMessage(out, "out");
>> >> >> >>                            send(exchange);
>> >> >> >>
>> >> >> >>                        } else if (input instanceof Unsubscribe)
>> {
>> >> >> >>                            subscription = null;
>> >> >> >>                            UnsubscribeResponse response = new
>> >> >> >> UnsubscribeResponse();
>> >> >> >>                            StringWriter writer = new
>> >> StringWriter();
>> >> >> >>                            jaxbContext.createMarshaller
>> >> >> >> ().marshal(response,
>> >> >> >> writer);
>> >> >> >>                            NormalizedMessage out =
>> >> >> exchange.createMessage
>> >> >> >> ();
>> >> >> >>                            out.setContent(new
>> >> >> >> StringSource(writer.toString
>> >> >> >> ()));
>> >> >> >>                            exchange.setMessage(out, "out");
>> >> >> >>                            send(exchange);
>> >> >> >>
>> >> >> >>
>> >> >> >>                        } else {
>> >> >> >>                            throw new Exception("Unkown
>> request");
>> >> >> >>                        }
>> >> >> >>                    } catch (Exception e) {
>> >> >> >>                        fail(exchange, e);
>> >> >> >>                    }
>> >> >> >>                // This is a notification to publish
>> >> >> >>                }
>> >> >> >>
>> >> >> >>                  else {
>> >> >> >>                    try {
>> >> >> >>                        if (!demand || subscription != null) {
>> >> >> >>                            Element elem = new
>> >> >> >> SourceTransformer().toDOMElement(exchange.getMessage("in"));
>> >> >> >>                            wsnBroker.notify(receiveTopic, elem);
>> >> >> >>                            done(exchange);
>> >> >> >>                        } else {
>> >> >> >>                            log.info("Ingore notification as the
>> >> >> publisher
>> >> >> >> is no
>> >> >> >> subscribers");
>> >> >> >>                        }
>> >> >> >>                    } catch (Exception e) {
>> >> >> >>                        fail(exchange, e);
>> >> >> >>                        }
>> >> >> >>                }
>> >> >> >>            }
>> >> >> >>
>> >> >> >>  }
>> >> >> >>
>> >> >> >>  ......
>> >> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> >> >> messageId
>> >> >> >> =
>> >> >> >> ID:martina-39597-1199704995676-3:0:1:1:5, originalDestination =
>> >> null,
>> >> >> >> originalTransactionId = null, producerId =
>> >> >> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
>> >> >> >> queue://org.apache.servicemix.jms.{
>> >> >> >>
>> >> >>
>> >>
>> http://servicemix.apache.org/demo}trace:endpoint<http://servicemix.apache.org/demo%7Dtrace:endpoint>
>> <http://servicemix.apache.org/demo%7Dtrace:endpoint>
>> >> <http://servicemix.apache.org/demo%7Dtrace:endpoint>
>> >> >> <http://servicemix.apache.org/demo%7Dtrace:endpoint>
>> >> >> >> ,
>> >> >> >> transactionId = null, expiration = 0, timestamp = 1199705011173,
>> >> >> arrival
>> >> >> >> =
>> >> >> >> 0, correlationId = null, replyTo = null, persistent = true, type
>> =
>> >> >> null,
>> >> >> >> priority = 4, groupID = null, groupSequence = 0,
>> targetConsumerId
>> =
>> >> >> null,
>> >> >> >> compressed = false, userID = null, content =
>> >> >> >> org.apache.activemq.util.ByteSequence@10a69f0,
>> marshalledProperties
>> >> =
>> >> >> >> null,
>> >> >> >> dataStructure = null, redeliveryCounter = 0, size = 0,
>> properties
>> =
>> >> >> null,
>> >> >> >> readOnlyProperties = true, readOnlyBody = true, droppable =
>> false}
>> >> >> >> INFO  - SubscriberComponent            - Exchange: InOnly[
>> >> >> >>  id: ID:192.168.0.172-11753fdefba-2:0
>> >> >> >>  status: Active
>> >> >> >>  role: provider
>> >> >> >>  endpoint: endpoint
>> >> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> >> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >> >> >>
>> >> >>
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing
>> "><name>My
>> >> >> >> Example
>> >> >> >>
>> Job</name><group>ServiceMix</group><fullname>ServiceMix.MyExample
>> >> >> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> >> >> ] received IN message:
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> org.apache.servicemix.jbi.messaging.NormalizedMessageImpl@b125bd{properties
>> >> >> >> :
>> >> >> >> {}}
>> >> >> >> INFO  - SubscriberComponent            - Body is: <?xml
>> >> version="1.0
>> >> "
>> >> >> >> encoding="UTF-8"?><ns2:Notify xmlns:ns2="
>> >> >> >> http://docs.oasis-open.org/wsn/b-2"
>> >> >> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >> >> >>
>> >> >>
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing
>> "><name>My
>> >> >> >> Example
>> >> >> >>
>> Job</name><group>ServiceMix</group><fullname>ServiceMix.MyExample
>> >> >> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
>> LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
>> >> >> status
>> >> >> =
>> >> >> >> getStatus()
>> >> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E
>> CAMBIA
>> >> LO
>> >> >> >> STATO
>> >> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> me.handleSend(sync)
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> >> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> >> container.sendExchange(mirror);
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> >> >> messageId
>> >> >> >> =
>> >> >> >> ID:martina-39597-1199704995676-3:0:1:1:6, originalDestination =
>> >> null,
>> >> >> >> originalTransactionId = null, producerId =
>> >> >> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
>> >> >> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
>> >> >> expiration
>> >> >> >> =
>> >> >> >> 0, timestamp = 1199705011183, arrival = 0, correlationId = null,
>> >> >> replyTo
>> >> >> >> =
>> >> >> >> null, persistent = true, type = null, priority = 4, groupID =
>> null,
>> >> >> >> groupSequence = 0, targetConsumerId = null, compressed = false,
>> >> userID
>> >> >> =
>> >> >> >> null, content = org.apache.activemq.util.ByteSequence@c70f32,
>> >> >> >> marshalledProperties = null, dataStructure = null,
>> >> redeliveryCounter
>> >> =
>> >> >> 0,
>> >> >> >> size = 0, properties = null, readOnlyProperties = true,
>> >> readOnlyBody
>> >> =
>> >> >> >> true,
>> >> >> >> droppable = false}
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> >> container.sendExchange(mirror);
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> >> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> >> >> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> >> >> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO
>> E':
>> >> >> InOnly[
>> >> >> >>  id: ID:192.168.0.172-11753fdefba-2:0
>> >> >> >>  status: Done
>> >> >> >>  role: provider
>> >> >> >>  endpoint: endpoint
>> >> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> >> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >> >> >>
>> >> >>
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing
>> "><name>My
>> >> >> >> Example
>> >> >> >>
>> Job</name><group>ServiceMix</group><fullname>ServiceMix.MyExample
>> >> >> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> >> >> ]
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
>> LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
>> >> >> status
>> >> >> =
>> >> >> >> getStatus()
>> >> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E
>> CAMBIA
>> >> LO
>> >> >> >> STATO
>> >> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> me.handleSend(sync)
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> >> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> >> DEBUG - WSNSpringComponent             - Received exchange:
>> status:
>> >> >> Done,
>> >> >> >> role: consumer
>> >> >> >> DEBUG - WSNSpringComponent             - Retrieved correlation
>> id:
>> >> >> null
>> >> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> >> >> messageId
>> >> >> >> =
>> >> >> >> ID:martina-39597-1199704995676-3:0:1:1:7, originalDestination =
>> >> null,
>> >> >> >> originalTransactionId = null, producerId =
>> >> >> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
>> >> >> >> queue://org.apache.servicemix.jms.{
>> >> >> >>
>> >> >>
>> >>
>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> >> >> ,
>> >> >> >> transactionId = null, expiration = 0, timestamp = 1199705011188,
>> >> >> arrival
>> >> >> >> =
>> >> >> >> 0, correlationId = null, replyTo = null, persistent = true, type
>> =
>> >> >> null,
>> >> >> >> priority = 4, groupID = null, groupSequence = 0,
>> targetConsumerId
>> =
>> >> >> null,
>> >> >> >> compressed = false, userID = null, content =
>> >> >> >> org.apache.activemq.util.ByteSequence@1c8f59c,
>> marshalledProperties
>> >> =
>> >> >> >> null,
>> >> >> >> dataStructure = null, redeliveryCounter = 0, size = 0,
>> properties
>> =
>> >> >> null,
>> >> >> >> readOnlyProperties = true, readOnlyBody = true, droppable =
>> false}
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> >> container.sendExchange(mirror);
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
>> LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
>> LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> ERROR - JMSFlow                        - Caught an exception
>> >> routing
>> >> >> >> ExchangePacket:
>> >> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
>> >> >> sendSync
>> >> >> >>        at
>> >> >> >>
>> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> >> >> >> MessageExchangeImpl.java:581)
>> >> >> >>        at
>> >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>> >> >> >> DeliveryChannelImpl.java:384)
>> >> >> >>        at
>> >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> >> >> >> DeliveryChannelImpl.java:444)
>> >> >> >>        at
>> >> >> >>
>> >> >>
>> >>
>> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
>> >> >> >> :249)
>> >> >> >>        at
>> >> >> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> >> >> >> SubscriberComponent.java:203)
>> >> >> >>        at
>> >> >> >>
>> >> >>
>> >>
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> >> >> >> DeliveryChannelImpl.java:621)
>> >> >> >>        at
>> >> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> >> >> >> AbstractFlow.java:174)
>> >> >> >>        at
>> org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3
>> (
>> >> >> >> JMSFlow.java:1)
>> >> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>> >> >> >> JMSFlow.java:543)
>> >> >> >>        at
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> >> >> >> (ThreadPoolExecutor.java:665)
>> >> >> >>        at
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> >> >> >> (ThreadPoolExecutor.java:690)
>> >> >> >>        at java.lang.Thread.run(Thread.java:595)
>> >> >> >>
>> >> >> >> Can you help me again?
>> >> >> >> Thanks in advance!
>> >> >> >>
>> >> >> >> Martina
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> gnodet wrote:
>> >> >> >> >
>> >> >> >> > You need to use an InOnly or RobustInOnly exchange, not an
>> InOut
>> >> >> >> exchange,
>> >> >> >> > as notifications do not have any out messages.
>> >> >> >> >
>> >> >> >> > On Jan 4, 2008 5:16 PM, martymusk <ma...@email.it> wrote:
>> >> >> >> >
>> >> >> >> >>
>> >> >> >> >> Thus , I've created a new class "SubscriberComponent" that is
>> a
>> >> >> copy
>> >> >> >> of
>> >> >> >> >> PublisherComponent. Trhough it instance2 receive exchange and
>> >> try
>> >> >> to
>> >> >> >> send
>> >> >> >> >> scambio (copy of exchange). When I run example the following
>> >> error
>> >> >> >> >> occurs...
>> >> >> >> >>
>> >> >> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired =
>> false,
>> >> >> >> messageId
>> >> >> >> >> =
>> >> >> >> >> ID:martina-38529-1199462112612-3:0:1:1:6, originalDestination
>> =
>> >> >> null,
>> >> >> >> >> originalTransactionId = null, producerId =
>> >> >> >> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
>> >> >> >> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
>> >> >> >> expiration
>> >> >> >> >> =
>> >> >> >> >> 0, timestamp = 1199462153935, arrival = 0, correlationId =
>> null,
>> >> >> >> replyTo
>> >> >> >> >> =
>> >> >> >> >> null, persistent = true, type = null, priority = 4, groupID =
>> >> null,
>> >> >> >> >> groupSequence = 0, targetConsumerId = null, compressed =
>> false,
>> >> >> userID
>> >> >> >> =
>> >> >> >> >> null, content = org.apache.activemq.util.ByteSequence@b2175,
>> >> >> >> >> marshalledProperties = null, dataStructure = null,
>> >> >> redeliveryCounter
>> >> >> =
>> >> >> >> 0,
>> >> >> >> >> size = 0, properties = null, readOnlyProperties = true,
>> >> >> readOnlyBody
>> >> >> =
>> >> >> >> >> true,
>> >> >> >> >> droppable = false}
>> >> >> >> >> DEBUG - WSNSpringComponent             - Received exchange:
>> >> status:
>> >> >> >> >> Active,
>> >> >> >> >> role: consumer
>> >> >> >> >> DEBUG - WSNSpringComponent             - Retrieved
>> correlation
>> >> id:
>> >> >> >> null
>> >> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> >> >> container.sendExchange(mirror);
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> >> >> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> >> >> >> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> >> >> >> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO
>> >> E':
>> >> >> >> InOut[
>> >> >> >> >>  id: ID:192.168.0.172-1174583cdf9-2:0
>> >> >> >> >>  status: Active
>> >> >> >> >>  role: provider
>> >> >> >> >>  endpoint: endpoint
>> >> >> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> >> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> >> >> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> >> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> >> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> >> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing
>> >> "><name>My
>> >> >> >> >> Example
>> >> >> >> >>
>> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.MyExample
>> >> >> >> >> Job</fullname><description/><fireTime>Fri Jan 04 16:55:53 CET
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> >> >> >> ]
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
>> >> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
>> >> LISTNERS
>> >> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> >> >> INFO  - MessageExchangeImpl            - PRIMA DI
>> ExchangeStatus
>> >> >> >> status
>> >> >> >> =
>> >> >> >> >> getStatus()
>> >> >> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E
>> >> CAMBIA
>> >> >> LO
>> >> >> >> >> STATO
>> >> >> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> >> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> >> me.handleSend(sync)
>> >> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> >> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> >> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired =
>> false,
>> >> >> >> messageId
>> >> >> >> >> =
>> >> >> >> >> ID:martina-38529-1199462112612-3:0:1:1:7, originalDestination
>> =
>> >> >> null,
>> >> >> >> >> originalTransactionId = null, producerId =
>> >> >> >> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
>> >> >> >> >> queue://org.apache.servicemix.jms.{
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> >> >>
>> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker
>> >
>> >> >> >> >> ,
>> >> >> >> >> transactionId = null, expiration = 0, timestamp =
>> 1199462153952,
>> >> >> >> arrival
>> >> >> >> >> =
>> >> >> >> >> 0, correlationId = null, replyTo = null, persistent = true,
>> type
>> >> =
>> >> >> >> null,
>> >> >> >> >> priority = 4, groupID = null, groupSequence = 0,
>> >> targetConsumerId
>> >> =
>> >> >> >> null,
>> >> >> >> >> compressed = false, userID = null, content =
>> >> >> >> >> org.apache.activemq.util.ByteSequence@779b3e,
>> >> marshalledProperties
>> >> >> =
>> >> >> >> >> null,
>> >> >> >> >> dataStructure = null, redeliveryCounter = 0, size = 0,
>> >> properties
>> >> =
>> >> >> >> null,
>> >> >> >> >> readOnlyProperties = true, readOnlyBody = true, droppable =
>> >> false}
>> >> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> >> >> container.sendExchange(mirror);
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E'
>> CHIUSO
>> >> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
>> >> LISTNERS
>> >> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E'
>> CHIUSO
>> >> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
>> >> LISTNERS
>> >> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> >> ERROR - JMSFlow                        - Caught an exception
>> >> >> routing
>> >> >> >> >> ExchangePacket:
>> >> >> >> >> javax.jbi.messaging.MessagingException: illegal call to send
>> /
>> >> >> >> sendSync
>> >> >> >> >>        at
>> >> >> >> >>
>> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> >> >> >> >> MessageExchangeImpl.java:581)
>> >> >> >> >>        at
>> >> >> >> >>
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend
>> (
>> >> >> >> >> DeliveryChannelImpl.java:384)
>> >> >> >> >>        at
>> >> >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> >> >> >> >> DeliveryChannelImpl.java:444)
>> >> >> >> >>        at
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
>> >> >> >> >> :249)
>> >> >> >> >>        at
>> >> >> >> >>
>> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> >> >> >> >> SubscriberComponent.java:203)
>> >> >> >> >>        at
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> >> >> >> >> DeliveryChannelImpl.java:621)
>> >> >> >> >>        at
>> >> >> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> >> >> >> >> AbstractFlow.java:174)
>> >> >> >> >>        at
>> >> org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3
>> >> (
>> >> >> >> >> JMSFlow.java:1)
>> >> >> >> >>        at
>> org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run
>> (
>> >> >> >> >> JMSFlow.java:543)
>> >> >> >> >>        at
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> >> >> >> >> (ThreadPoolExecutor.java:665)
>> >> >> >> >>        at
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> >> >> >> >> (ThreadPoolExecutor.java:690)
>> >> >> >> >>        at java.lang.Thread.run(Thread.java:595)
>> >> >> >> >>
>> >> >> >> >> I do wrong again?
>> >> >> >> >>
>> >> >> >> >> Thank you!!!
>> >> >> >> >> Martina
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> gnodet wrote:
>> >> >> >> >> >
>> >> >> >> >> > You should have a look at the existing code:
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/spring/PublisherComponent.java?r=602828
>> >> >> >> >> >
>> >> >> >> >> > Note that the publisher component actually use the client
>> api
>> >> >> (line
>> >> >> >> >> 172).
>> >> >> >> >> > For details on thow the client api works (which is how to
>> send
>> >> a
>> >> >> JBI
>> >> >> >> >> > exchange to the WSN broker), see:
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/client/NotificationBroker.java?r=602828#l89
>> >> >> >> >> >
>> >> >> >> >> > I would advise you to start from the publisher component,
>> copy
>> >> it
>> >> >> >> and
>> >> >> >> >> use
>> >> >> >> >> > it
>> >> >> >> >> > instead of your TraceComponent.
>> >> >> >> >> > Each time it receives a JBI exchange, it will publish it
>> >> through
>> >> >> the
>> >> >> >> >> > WSNotification broker.
>> >> >> >> >> >
>> >> >> >> >> > Also look at the various resources on the web site that may
>> >> help
>> >> >> >> you:
>> >> >> >> >> >   http://servicemix.apache.org/servicemix-wsn2005.html
>> >> >> >> >> >   http://servicemix.apache.org/example-scenario.html
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > On Jan 4, 2008 2:58 PM, martymusk <ma...@email.it>
>> wrote:
>> >> >> >> >> >
>> >> >> >> >> >>
>> >> >> >> >> >> Hy gnodet and thank you very much for your helpfulness,
>> >> >> >> >> >> but I don't understand exactly what I must to do.
>> >> >> >> >> >>
>> >> >> >> >> >> How can I send JBI exchange to the WSN broker directly?
>> >> >> >> >> >> How can I use WSN client api.
>> >> >> >> >> >>
>> >> >> >> >> >> I'm working for a thesis at University of Naples.
>> >> >> >> >> >> My purpose is to study WSN performance.
>> >> >> >> >> >> I've found your WSN implementation very useful for me, but
>> to
>> >> >> study
>> >> >> >> >> >> performance, I need exchange was send back.
>> >> >> >> >> >> It is more than a mounth I'm triyng to do this.
>> >> >> >> >> >>
>> >> >> >> >> >> I would be very grateful if you can help me. Otherwise,
>> there
>> >> >> are
>> >> >> >> no
>> >> >> >> >> >> problems, I'll keep on study over and over again, hoping I
>> be
>> >> >> able
>> >> >> >> to
>> >> >> >> >> >> achieve my purpose.
>> >> >> >> >> >>
>> >> >> >> >> >> Thank you very much.
>> >> >> >> >> >> Martina
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >> gnodet wrote:
>> >> >> >> >> >> >
>> >> >> >> >> >> > I thought I pointed you to the right direction.
>> >> >> >> >> >> > Do not use the PublisherComponent that way: either use
>> it
>> >> as
>> >> >> it
>> >> >> >> is
>> >> >> >> >> >> > intended
>> >> >> >> >> >> > (deploy it as a component onto the lightweight
>> container)
>> >> or
>> >> >> use
>> >> >> >> the
>> >> >> >> >> >> WSN
>> >> >> >> >> >> > client api:
>> >> >> >> >> >> >    wsn.notify(topic, msg)
>> >> >> >> >> >> >
>> >> >> >> >> >> > I'm not sure what you are trying to achieve with your
>> >> >> >> >> TraceComponent.
>> >> >> >> >> >>  It
>> >> >> >> >> >> > sounds like you want to reimplement the
>> PublisherComponent.
>> >> >> If
>> >> >> >> so,
>> >> >> >> >> you
>> >> >> >> >> >> > should have a look at how it is implemented and patch
>> it.
>> >> >> >> >> >> >
>> >> >> >> >> >> > Also note that both PublisherComponent and the WSN
>> client
>> >> api
>> >> >> are
>> >> >> >> >> just
>> >> >> >> >> >> > sugar, you can send a JBI exchange to the WSN broker
>> >> directly
>> >> >> if
>> >> >> >> you
>> >> >> >> >> >> want.
>> >> >> >> >> >> >
>> >> >> >> >> >> > On Jan 4, 2008 2:13 PM, martymusk <ma...@email.it>
>> >> wrote:
>> >> >> >> >> >> >
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> My problem is always the same!
>> >> >> >> >> >> >> In wsn-example, after Consumer received an exchange,
>> I'd
>> >> like
>> >> >> it
>> >> >> >> >> send
>> >> >> >> >> >> >> copy
>> >> >> >> >> >> >> of it. But it doesn't happen. :-(
>> >> >> >> >> >> >> I've modified TraceComponent class in the following
>> way,
>> >> but
>> >> >> it
>> >> >> >> >> >> doesn't
>> >> >> >> >> >> >> work
>> >> >> >> >> >> >> fine:
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> package org.apache.servicemix.wsn;
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> import java.io.StringWriter;
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> import javax.jbi.JBIException;
>> >> >> >> >> >> >> import javax.jbi.messaging.ExchangeStatus;
>> >> >> >> >> >> >> import javax.jbi.messaging.MessageExchange;
>> >> >> >> >> >> >> import javax.jbi.messaging.MessagingException;
>> >> >> >> >> >> >> import javax.jbi.messaging.NormalizedMessage;
>> >> >> >> >> >> >> import javax.xml.bind.JAXBContext;
>> >> >> >> >> >> >> import javax.xml.transform.Source;
>> >> >> >> >> >> >> import javax.xml.transform.TransformerException;
>> >> >> >> >> >> >> //import javax.jbi.messaging.InOut;
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> import
>> >> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl
>> >> >> ;
>> >> >> >> >> >> >> import org.apache.servicemix.jbi.messaging.InOutImpl;
>> >> >> >> >> >> >> import org.apache.commons.logging.Log;
>> >> >> >> >> >> >> import org.apache.commons.logging.LogFactory;
>> >> >> >> >> >> >> import org.apache.servicemix.MessageExchangeListener;
>> >> >> >> >> >> >> import
>> >> >> org.apache.servicemix.components.util.ComponentSupport;
>> >> >> >> >> >> >> import
>> >> org.apache.servicemix.wsn.spring.PublisherComponent;
>> >> >> >> >> >> >> import
>> org.apache.servicemix.jbi.jaxp.SourceTransformer;
>> >> >> >> >> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
>> >> >> >> >> >> >> import
>> org.apache.servicemix.wsn.client.AbstractWSAClient;
>> >> >> >> >> >> >> import
>> >> org.apache.servicemix.wsn.client.NotificationBroker;
>> >> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
>> >> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
>> >> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
>> >> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
>> >> >> >> >> >> >> import org.w3c.dom.Element;
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> public class TraceComponent extends ComponentSupport
>> >> >> implements
>> >> >> >> >> >> >>                MessageExchangeListener {
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>        private Log log =
>> >> >> >> LogFactory.getLog(TraceComponent.class);
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>        private SourceTransformer sourceTransformer =
>> new
>> >> >> >> >> >> >> SourceTransformer();
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>        public Log getLog() {
>> >> >> >> >> >> >>                return log;
>> >> >> >> >> >> >>        }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>        public void setLog(Log log) {
>> >> >> >> >> >> >>                this.log = log;
>> >> >> >> >> >> >>        }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>        public SourceTransformer getSourceTransformer()
>> {
>> >> >> >> >> >> >>                return sourceTransformer;
>> >> >> >> >> >> >>        }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>        public void
>> setSourceTransformer(SourceTransformer
>> >> >> >> >> >> >> sourceTransformer) {
>> >> >> >> >> >> >>                this.sourceTransformer =
>> sourceTransformer;
>> >> >> >> >> >> >>        }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>        //AGGIUNGO CODICE
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>        PublisherComponent publisher = new
>> >> >> PublisherComponent();
>> >> >> >> >> >> >>          private String subscriptionEndpoint =
>> >> >> "subscription";
>> >> >> >> >> >> >>          private NotificationBroker wsnBroker;
>> >> >> >> >> >> >>          private String topic;
>> >> >> >> >> >> >>          private String msg;
>> >> >> >> >> >> >>          private boolean demand;
>> >> >> >> >> >> >>          private Subscribe subscription;
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>          public String getTopic() {
>> >> >> >> >> >> >>                return topic;
>> >> >> >> >> >> >>            }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>            /**
>> >> >> >> >> >> >>             * @param topic The topic to set.
>> >> >> >> >> >> >>             */
>> >> >> >> >> >> >>            public void setTopic(String topic) {
>> >> >> >> >> >> >>               this.topic = topic;
>> >> >> >> >> >> >>            }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>         public void init() throws JBIException {
>> >> >> >> >> >> >>                super.init();
>> >> >> >> >> >> >>
>>  getContext().activateEndpoint(getService(),
>> >> >> >> >> >> >> subscriptionEndpoint);
>> >> >> >> >> >> >>                 log.info("METODO INIT");
>> >> >> >> >> >> >>                // publisher.init();
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                 publisher.setTopic(topic);
>> >> >> >> >> >> >>            }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>            /* (non-Javadoc)
>> >> >> >> >> >> >>             * @see
>> >> >> javax.jbi.management.LifeCycleMBean#start()
>> >> >> >> >> >> >>             */
>> >> >> >> >> >> >>            public void start() throws JBIException {
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                log.info("METODO START");
>> >> >> >> >> >> >>                //publisher.start();
>> >> >> >> >> >> >>                new Thread() {
>> >> >> >> >> >> >>                  public void run() {
>> >> >> >> >> >> >>                       try {
>> >> >> >> >> >> >>                           wsnBroker = new
>> >> >> >> >> >> >> NotificationBroker(getContext());
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                           String wsaAddress =
>> >> >> >> >> >> >> getService().getNamespaceURI() + "/"
>> >> >> >> >> >> >> + getService().getLocalPart() + "/" +
>> >> subscriptionEndpoint;
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >>
>> >> >>
>> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
>> >> >> >> >> >> >>
>> >> topic,
>> >> >> >> >> >> >>
>> >> >>  demand);
>> >> >> >> >> >> >>                        } catch (Exception e) {
>> >> >> >> >> >> >>                            log.error("Could not create
>> wsn
>> >> >> >> client",
>> >> >> >> >> >> e);
>> >> >> >> >> >> >>                        }
>> >> >> >> >> >> >>                    }
>> >> >> >> >> >> >>                }.start();
>> >> >> >> >> >> >>            }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>            public void shutDown() throws JBIException {
>> >> >> >> >> >> >>                log.info("METODO SHUTDOWN");
>> >> >> >> >> >> >>            //  publisher.shutDown();
>> >> >> >> >> >> >>               super.shutDown();
>> >> >> >> >> >> >>            }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>            //FINE CODICE AGGIUNTO
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>        public void onMessageExchange(MessageExchange
>> >> >> exchange)
>> >> >> >> >> >> >>                        throws MessagingException {
>> >> >> >> >> >> >>                // lets dump the incoming message
>> >> >> >> >> >> >>                NormalizedMessage message =
>> >> >> exchange.getMessage
>> >> >> >> >> ("in");
>> >> >> >> >> >> >>                if (message == null) {
>> >> >> >> >> >> >>                        log.warn("Received null message
>> >> from
>> >> >> >> >> exchange:
>> >> >> >> >> >> "
>> >> >> >> >> >> +
>> >> >> >> >> >> >> exchange);
>> >> >> >> >> >> >>                } else {
>> >> >> >> >> >> >>                        log.info("Exchange: " + exchange
>> +
>> >> "
>> >> >> >> >> received
>> >> >> >> >> >> IN
>> >> >> >> >> >> >> message: "
>> >> >> >> >> >> >>                                        + message);
>> >> >> >> >> >> >>                        try {
>> >> >> >> >> >> >>                                log.info("Body is: "
>> >> >> >> >> >> >>                                                +
>> >> >> >> >> >> >> sourceTransformer.toString(message.getContent()));
>> >> >> >> >> >> >>                        } catch (TransformerException e)
>> {
>> >> >> >> >> >> >>                                log.error("Failed to
>> turn
>> >> >> message
>> >> >> >> >> body
>> >> >> >> >> >> >> into
>> >> >> >> >> >> >> text: " + e, e);
>> >> >> >> >> >> >>                        }
>> >> >> >> >> >> >>                }
>> >> >> >> >> >> >>                done(exchange);
>> >> >> >> >> >> >>                log.info("MESSAGGIO RICEVUTO");
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                log.info("COPIO IL PACCHETTO");
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                MessageExchange scambio =
>> >> >> >> (MessageExchange)exchange;
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                log.info("INVIO");
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>          try{
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                log.info("FASE INVIO");
>> >> >> >> >> >> >>                //publisher.onMessageExchange(scambio);
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                //AGGIUNGO onMessageExchange
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                if (exchange.getStatus() !=
>> >> >> >> ExchangeStatus.ACTIVE)
>> >> >> >> {
>> >> >> >> >> >> >>                    return;
>> >> >> >> >> >> >>                }
>> >> >> >> >> >> >>                // This is a notification from the WSN
>> >> broker
>> >> >> >> >> >> >>                if
>> >> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
>> >> >> >> >> >> {
>> >> >> >> >> >> >>                    try {
>> >> >> >> >> >> >>                        JAXBContext jaxbContext =
>> >> >> >> >> >> >> JAXBContext.newInstance(Subscribe.class);
>> >> >> >> >> >> >>                        Source src = exchange.getMessage
>> >> >> >> >> >> >> ("in").getContent();
>> >> >> >> >> >> >>                        Object input =
>> >> >> >> >> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
>> >> >> >> >> >> >>                        if (input instanceof Subscribe)
>> {
>> >> >> >> >> >> >>                            subscription = (Subscribe)
>> >> input;
>> >> >> >> >> >> >>                            SubscribeResponse response =
>> >> new
>> >> >> >> >> >> >> SubscribeResponse();
>> >> >> >> >> >> >>                            String wsaAddress =
>> >> >> >> >> >> >> getService().getNamespaceURI() +
>> >> >> >> >> >> >> "/" + getService().getLocalPart() + "/" +
>> >> >> subscriptionEndpoint;
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> response.setSubscriptionReference(
>> >> AbstractWSAClient.createWSA
>> >> >> >> >> >> >> (wsaAddress));
>> >> >> >> >> >> >>                            StringWriter writer = new
>> >> >> >> >> StringWriter();
>> >> >> >> >> >> >>                            jaxbContext.createMarshaller
>> >> >> >> >> >> >> ().marshal(response,
>> >> >> >> >> >> >> writer);
>> >> >> >> >> >> >>                            NormalizedMessage out =
>> >> >> >> >> >> exchange.createMessage
>> >> >> >> >> >> >> ();
>> >> >> >> >> >> >>                            out.setContent(new
>> >> >> >> >> >> >> StringSource(writer.toString
>> >> >> >> >> >> >> ()));
>> >> >> >> >> >> >>                            exchange.setMessage(out,
>> >> "out");
>> >> >> >> >> >> >>                            send(exchange);
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                        } else if (input instanceof
>> >> >> Unsubscribe)
>> >> >> >> {
>> >> >> >> >> >> >>                            subscription = null;
>> >> >> >> >> >> >>                            UnsubscribeResponse response
>> =
>> >> new
>> >> >> >> >> >> >> UnsubscribeResponse();
>> >> >> >> >> >> >>                            StringWriter writer = new
>> >> >> >> >> StringWriter();
>> >> >> >> >> >> >>                            jaxbContext.createMarshaller
>> >> >> >> >> >> >> ().marshal(response,
>> >> >> >> >> >> >> writer);
>> >> >> >> >> >> >>                            NormalizedMessage out =
>> >> >> >> >> >> exchange.createMessage
>> >> >> >> >> >> >> ();
>> >> >> >> >> >> >>                            out.setContent(new
>> >> >> >> >> >> >> StringSource(writer.toString
>> >> >> >> >> >> >> ()));
>> >> >> >> >> >> >>                            exchange.setMessage(out,
>> >> "out");
>> >> >> >> >> >> >>                            send(exchange);
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                        } else {
>> >> >> >> >> >> >>                            throw new Exception("Unkown
>> >> >> >> request");
>> >> >> >> >> >> >>                        }
>> >> >> >> >> >> >>                    } catch (Exception e) {
>> >> >> >> >> >> >>                        fail(exchange, e);
>> >> >> >> >> >> >>                    }
>> >> >> >> >> >> >>                // This is a notification to publish
>> >> >> >> >> >> >>                }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                  else {
>> >> >> >> >> >> >>                    try {
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                    log.info("SALTA");
>> >> >> >> >> >> >>                        if (!demand || subscription !=
>> >> null)
>> >> {
>> >> >> >> >> >> >>                                log.info("ENTRO
>> NELL'IF");
>> >> >> >> >> >> >>                           // Element elem = new
>> >> >> >> >> >> >> SourceTransformer().toDOMElement(exchange.getMessage
>> >> ("in"));
>> >> >> >> >> >> >>                            log.info("PRIMA DI
>> WSNBROKER");
>> >> >> >> >> >> >>                            wsnBroker.notify(topic,
>> msg);
>> >> >> >> >> >> >>                            log.info("PRIMA DI DONE");
>> >> >> >> >> >> >>
>> >> >>  getDeliveryChannel().send(exchange);
>> >> >> >> >> >> >>                            log.info("DOPO DI DONE");
>> >> >> >> >> >> >>                        } else {
>> >> >> >> >> >> >>                            log.info("Ingore
>> notification
>> >> as
>> >> >> the
>> >> >> >> >> >> publisher
>> >> >> >> >> >> >> is no
>> >> >> >> >> >> >> subscribers");
>> >> >> >> >> >> >>                        }
>> >> >> >> >> >> >>                    } catch (Exception e) {
>> >> >> >> >> >> >>                        fail(exchange, e);
>> >> >> >> >> >> >>                        }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                log.debug("IL PACCHETTO INVIATO E': " +
>> >> >> scambio);
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>                  }
>> >> >> >> >> >> >>                //FINE onMessageExchange
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>           } catch(JBIException e){
>> >> >> >> >> >> >>                  log.error("ECCEZIONE GENERATA!");
>> >> >> >> >> >> >>          }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>      log.info("INVIATO");
>> >> >> >> >> >> >> }
>> >> >> >> >> >> >> }
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> Help me if you can.
>> >> >> >> >> >> >> Thank you very much for your helpfulness...
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> Martina
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> gnodet wrote:
>> >> >> >> >> >> >> >
>> >> >> >> >> >> >> > You should not have to deal nor see the internal
>> state
>> >> of
>> >> >> the
>> >> >> >> >> >> exchange.
>> >> >> >> >> >> >> > If guess you have an exception when trying to send an
>> >> >> >> exchange,
>> >> >> >> >> but
>> >> >> >> >> >> >> this
>> >> >> >> >> >> >> > means that there is a problem in your code.  You
>> should
>> >> >> post
>> >> >> a
>> >> >> >> >> >> snippet
>> >> >> >> >> >> >> of
>> >> >> >> >> >> >> > your code that is failing so that we can help you.
>> >> >> >> >> >> >> >
>> >> >> >> >> >> >> > On Jan 4, 2008 12:22 PM, martymusk
>> <martymusk@email.it
>> >
>> >> >> wrote:
>> >> >> >> >> >> >> >
>> >> >> >> >> >> >> >>
>> >> >> >> >> >> >> >> Hy,
>> >> >> >> >> >> >> >> I've a question...
>> >> >> >> >> >> >> >> can I set anywhere Consumer to CAN_SEND?
>> >> >> >> >> >> >> >>
>> >> >> >> >> >> >> >> I hope you can help me.
>> >> >> >> >> >> >> >> Thank you in advance.
>> >> >> >> >> >> >> >>
>> >> >> >> >> >> >> >> Martina
>> >> >> >> >> >> >> >> --
>> >> >> >> >> >> >> >> View this message in context:
>> >> >> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >>
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
>> >> >> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive
>> at
>> >> >> >> >> Nabble.com.
>> >> >> >> >> >> >> >>
>> >> >> >> >> >> >> >>
>> >> >> >> >> >> >> >
>> >> >> >> >> >> >> >
>> >> >> >> >> >> >> > --
>> >> >> >> >> >> >> > Cheers,
>> >> >> >> >> >> >> > Guillaume Nodet
>> >> >> >> >> >> >> > ------------------------
>> >> >> >> >> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >> >> >> >> >
>> >> >> >> >> >> >> >
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> --
>> >> >> >> >> >> >> View this message in context:
>> >> >> >> >> >> >>
>> >> >> >> >>
>> >> >>
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616107.html
>> >> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> >> >> >> Nabble.com.
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >
>> >> >> >> >> >> >
>> >> >> >> >> >> > --
>> >> >> >> >> >> > Cheers,
>> >> >> >> >> >> > Guillaume Nodet
>> >> >> >> >> >> > ------------------------
>> >> >> >> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >> >> >> >
>> >> >> >> >> >> >
>> >> >> >> >> >>
>> >> >> >> >> >> --
>> >> >> >> >> >> View this message in context:
>> >> >> >> >> >>
>> >> >> >>
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616748.html
>> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> >> >> Nabble.com.
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > --
>> >> >> >> >> > Cheers,
>> >> >> >> >> > Guillaume Nodet
>> >> >> >> >> > ------------------------
>> >> >> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >>
>> >> >> >> >> --
>> >> >> >> >> View this message in context:
>> >> >> >> >>
>> >> >>
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14619757.html
>> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> >> Nabble.com.
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > --
>> >> >> >> > Cheers,
>> >> >> >> > Guillaume Nodet
>> >> >> >> > ------------------------
>> >> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >> --
>> >> >> >> View this message in context:
>> >> >> >>
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14663812.html
>> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> Nabble.com.
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > Cheers,
>> >> >> > Guillaume Nodet
>> >> >> > ------------------------
>> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14664874.html
>> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > Cheers,
>> >> > Guillaume Nodet
>> >> > ------------------------
>> >> > Blog: http://gnodet.blogspot.com/
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14665988.html
>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> > Cheers,
>> > Guillaume Nodet
>> > ------------------------
>> > Blog: http://gnodet.blogspot.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14716016.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14730830.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Consumer Can Send

Posted by Guillaume Nodet <gn...@gmail.com>.
This is done by the WS-Notification client api, which in turns use the
ServiceMixClient interface.  So the actual exchange creation is a bit
hidden.


On Jan 9, 2008 5:56 PM, martymusk <ma...@email.it> wrote:

>
>  Please gnodet,
> I've a doubt in my mind...
>
> Can you point me  where consumer creates exchange and call send?
> This is the first step of exchange beetwen components, it's right?
>
> But what is the snippet code that make this?
> In PublisherComponent class?
> I'm unable to identify it.
>
> Can you help me, please?
> Thanks in advance
>
> Martina
>
>
>
>
>
>
> gnodet wrote:
> >
> > You need to understand how exchanges are sent between components.
> > For a simple InOnly exchange, it will be the following:
> >    * consumer create the exchange and call send
> >    * provider receives the exchange (possibly in onMessageExchange)
> >    * provide set the done status and call send
> >    * consumer receives the exchange in a DONE status
> >
> > In your case, the PublisherComponent acts both as a consumer and a
> > provider,
> > because it receives an exchange and send a copy to the broker, so the
> > onMessageExchange will be called multiple times:
> >    * first when it receives the first exchange and acts as the provider
> > (it
> > creates a new exchange and send it by using the WSNotification client
> api)
> >    * then when the exchange comes back with a DONE status
> >
> > The log you pasted below is fine but is the second call to the method
> (you
> > can see the DONE status and even the content of the exchange that has
> been
> > previously sent).  Check earlier in your log and you will find what you
> > need.
> >
> > On Jan 7, 2008 2:39 PM, martymusk <ma...@email.it> wrote:
> >
> >>
> >> I've tried with original code, and it returns because status is DONE.
> >> I post output obtained with original code:
> >>
> >> DEBUG - WSNSpringComponent             - Received exchange: status:
> Done,
> >> role: consumer
> >> DEBUG - WSNSpringComponent             - Retrieved correlation id: null
> >> INFO  - DeliveryChannelImpl            - DOPO
> >> container.sendExchange(mirror);
> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
> InOnly[
> >>  id: ID:192.168.0.172-1175476963a-2:0
> >>  status: Done
> >>  role: provider
> >>  endpoint: endpoint
> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
> >> Example
> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> >> Job</fullname><description/><fireTime>Mon Jan 07 14:35:12 CET
> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> ]
> >> INFO  - SubscriberComponent            - RETURNS BECAUSE STATUS IS:
> Done
> >>
> >> So I've tried to modify ACTIVE with DONE, hoping it carry on, but it
> >> fails
> >> with error I've posted previously.
> >>
> >> I don't understand what I do wrong!
> >> It's more than a mounth I'm trying to return back exchange. :-(
> >>
> >> Thank you very much for help you give me!
> >>
> >> Martina
> >>
> >>
> >>
> >> gnodet wrote:
> >> >
> >> > Have you tried with the original code before modifying the class from
> >> > ServiceMix ?
> >> > The first lines of the SubscriberComponent#onMessageExchange are
> >> >
> >> >  if (exchange.getStatus() != ExchangeStatus.ACTIVE) {
> >> >      return;
> >> >  }
> >> >
> >> > This is because you have to ignore exchanges in an Error / Done
> status.
> >> > From the code you pasted, it seems you removed those lines and
> instead
> >> do
> >> > some copy work and call done() which will fail for exchanges that are
> >> not
> >> > active.
> >> >
> >> > You can add debugging statements if you need (debug remoting works
> fine
> >> > too), but please try with the original code first.
> >> >
> >> > On Jan 7, 2008 1:52 PM, martymusk <ma...@email.it> wrote:
> >> >
> >> >>
> >> >> Thank you very much...
> >> >> The exception is the same, I post it:
> >> >>
> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> >> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> >> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> >> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
> >> InOnly[
> >> >>  id: ID:192.168.0.172-11754495367-2:0
> >> >>  status: Done
> >> >>  role: provider
> >> >>  endpoint: endpoint
> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> >> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >> >>
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
> >> >> Example
> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> >> >> Job</fullname><description/><fireTime>Mon Jan 07 13:46:56 CET
> >> >>
> >> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> >> ]
> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
> >> status
> >> =
> >> >> getStatus()
> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA
> LO
> >> >> STATO
> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
> >> >> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >> >> DEBUG - JMSFlow                        - Called Flow send
> >> >> DEBUG - ActiveMQSession                - Sending message:
> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> >> messageId
> >> >> =
> >> >> ID:martina-39867-1199709997721-3:0:1:1:7, originalDestination =
> null,
> >> >> originalTransactionId = null, producerId =
> >> >> ID:martina-39867-1199709997721-3:0:1:1, destination =
> >> >> queue://org.apache.servicemix.jms.{
> >> >>
> >> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> >> ,
> >> >> transactionId = null, expiration = 0, timestamp = 1199710016807,
> >> arrival
> >> >> =
> >> >> 0, correlationId = null, replyTo = null, persistent = true, type =
> >> null,
> >> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
> >> null,
> >> >> compressed = false, userID = null, content =
> >> >> org.apache.activemq.util.ByteSequence@5ac5f, marshalledProperties =
> >> null,
> >> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
> >> null,
> >> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
> >> >> INFO  - DeliveryChannelImpl            - DOPO
> >> >> container.sendExchange(mirror);
> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> ERROR - JMSFlow                        - Caught an exception routing
> >> >> ExchangePacket:
> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
> >> sendSync
> >> >>        at
> >> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> >> >> MessageExchangeImpl.java:581)
> >> >>        at
> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> >> >> DeliveryChannelImpl.java:384)
> >> >>        at
> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> >> >> DeliveryChannelImpl.java:444)
> >> >>        at
> >> >>
> >> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
> >> >> :249)
> >> >>        at
> >> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> >> >> SubscriberComponent.java:204)
> >> >>        at
> >> >>
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> >> >> DeliveryChannelImpl.java:621)
> >> >>        at
> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> >> >> AbstractFlow.java:174)
> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
> >> >> JMSFlow.java:1)
> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
> >> >> JMSFlow.java:543)
> >> >>        at
> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> >> >> (ThreadPoolExecutor.java:665)
> >> >>        at
> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> >> >> (ThreadPoolExecutor.java:690)
> >> >>        at java.lang.Thread.run(Thread.java:595)
> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
> >> sendSync
> >> >>        at
> >> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> >> >> MessageExchangeImpl.java:581)
> >> >>        at
> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> >> >> DeliveryChannelImpl.java:384)
> >> >>        at
> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> >> >> DeliveryChannelImpl.java:444)
> >> >>        at
> >> >>
> >> org.apache.servicemix.components.util.PojoSupport.done(PojoSupport.java
> >> >> :193)
> >> >>        at
> >> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> >> >> SubscriberComponent.java:198)
> >> >>        at
> >> >>
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> >> >> DeliveryChannelImpl.java:621)
> >> >>        at
> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> >> >> AbstractFlow.java:174)
> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
> >> >> JMSFlow.java:1)
> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
> >> >> JMSFlow.java:543)
> >> >>        at
> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> >> >> (ThreadPoolExecutor.java:665)
> >> >>        at
> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> >> >> (ThreadPoolExecutor.java:690)
> >> >>        at java.lang.Thread.run(Thread.java:595)
> >> >>
> >> >> What do I do wrong?
> >> >> Thanks in advance!
> >> >>
> >> >> Martina
> >> >>
> >> >>
> >> >> gnodet wrote:
> >> >> >
> >> >> > Just before calling fail(exchange, e), could you display the stack
> >> >> trace
> >> >> > of
> >> >> > the exception ?
> >> >> >    e.printStackTrace()
> >> >> > and send this error ?
> >> >> > This is the real error, but it seems to be hidden by fail()
> throwing
> >> >> > another
> >> >> > excepiton.
> >> >> >
> >> >> > On Jan 7, 2008 12:32 PM, martymusk <ma...@email.it> wrote:
> >> >> >
> >> >> >>
> >> >> >> Hy gnodet,
> >> >> >> thank you for your felpfulness.
> >> >> >> Thus, I've used InOnly exchange, but I've the same error.
> >> >> >> I post you my class and the error.
> >> >> >>
> >> >> >> package org.apache.servicemix.wsn;
> >> >> >>
> >> >> >>
> >> >> >> import java.io.StringWriter;
> >> >> >>
> >> >> >> import javax.jbi.JBIException;
> >> >> >> import javax.jbi.messaging.ExchangeStatus;
> >> >> >> import javax.jbi.messaging.MessageExchange;
> >> >> >> import javax.jbi.messaging.MessagingException;
> >> >> >> import javax.jbi.messaging.NormalizedMessage;
> >> >> >> import javax.xml.bind.JAXBContext;
> >> >> >> import javax.xml.transform.Source;
> >> >> >> import javax.xml.transform.TransformerException;
> >> >> >>
> >> >> >> import org.apache.commons.logging.Log;
> >> >> >> import org.apache.commons.logging.LogFactory;
> >> >> >> import org.apache.servicemix.MessageExchangeListener;
> >> >> >> import org.apache.servicemix.components.util.ComponentSupport;
> >> >> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
> >> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
> >> >> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
> >> >> >> import org.apache.servicemix.wsn.client.NotificationBroker;
> >> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
> >> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
> >> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
> >> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
> >> >> >> import org.w3c.dom.Element;
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>  public class SubscriberComponent extends ComponentSupport
> >> implements
> >> >> >> MessageExchangeListener {
> >> >> >>
> >> >> >>            private static final Log log =
> >> >> >> LogFactory.getLog(SubscriberComponent.class);
> >> >> >>
> >> >> >>            private NotificationBroker wsnBroker;
> >> >> >>            private String receiveTopic;
> >> >> >>            private boolean demand;
> >> >> >>            private String subscriptionEndpoint = "subscription";
> >> >> >>            private Subscribe subscription;
> >> >> >>
> >> >> >>            /**
> >> >> >>             * @return Returns the demand.
> >> >> >>             */
> >> >> >>            public boolean getDemand() {
> >> >> >>                return demand;
> >> >> >>            }
> >> >> >>
> >> >> >>            /**
> >> >> >>             * @param demand The demand to set.
> >> >> >>             */
> >> >> >>            public void setDemand(boolean demand) {
> >> >> >>                this.demand = demand;
> >> >> >>            }
> >> >> >>
> >> >> >>            /**
> >> >> >>             * @return Returns the topic.
> >> >> >>             */
> >> >> >>            public String getTopic() {
> >> >> >>                return receiveTopic;
> >> >> >>            }
> >> >> >>
> >> >> >>            /**
> >> >> >>             * @param topic The topic to set.
> >> >> >>             */
> >> >> >>            public void setTopic(String receiveTopic) {
> >> >> >>                this.receiveTopic = receiveTopic;
> >> >> >>            }
> >> >> >>
> >> >> >>            /**
> >> >> >>             * @return Returns the subscription.
> >> >> >>             */
> >> >> >>            public Subscribe getSubscription() {
> >> >> >>                return subscription;
> >> >> >>            }
> >> >> >>
> >> >> >>            /* (non-Javadoc)
> >> >> >>             * @see
> >> >> >> org.apache.servicemix.jbi.management.BaseLifeCycle#init
> >> >> >> ()
> >> >> >>             */
> >> >> >>            public void init() throws JBIException {
> >> >> >>                super.init();
> >> >> >>                getContext().activateEndpoint(getService(),
> >> >> >> subscriptionEndpoint);
> >> >> >>            }
> >> >> >>
> >> >> >>            /* (non-Javadoc)
> >> >> >>             * @see javax.jbi.management.LifeCycleMBean#start()
> >> >> >>             */
> >> >> >>            public void start() throws JBIException {
> >> >> >>                new Thread() {
> >> >> >>                    public void run() {
> >> >> >>                        try {
> >> >> >>                            wsnBroker = new
> >> >> >> NotificationBroker(getContext());
> >> >> >>                            String wsaAddress =
> >> >> >> getService().getNamespaceURI() +
> >> >> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
> >> >> >>
> >> >> >>
> >> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
> >> >> >>
> >> receiveTopic,
> >> >> >>                                                        demand);
> >> >> >>                        } catch (Exception e) {
> >> >> >>                            log.error("Could not create wsn
> client",
> >> >> e);
> >> >> >>                        }
> >> >> >>                    }
> >> >> >>                }.start();
> >> >> >>            }
> >> >> >>
> >> >> >>
> >> >> >>            private SourceTransformer sourceTransformer = new
> >> >> >> SourceTransformer();
> >> >> >>
> >> >> >>            public SourceTransformer getSourceTransformer() {
> >> >> >>                        return sourceTransformer;
> >> >> >>                }
> >> >> >>
> >> >> >>                public void setSourceTransformer(SourceTransformer
> >> >> >> sourceTransformer) {
> >> >> >>                        this.sourceTransformer =
> sourceTransformer;
> >> >> >>                }
> >> >> >>
> >> >> >>            /* (non-Javadoc)
> >> >> >>             * @see javax.jbi.management.LifeCycleMBean#shutDown()
> >> >> >>             */
> >> >> >>            public void shutDown() throws JBIException {
> >> >> >>                super.shutDown();
> >> >> >>            }
> >> >> >>
> >> >> >>            /* (non-Javadoc)
> >> >> >>             * @see
> >> >> >> org.apache.servicemix.MessageExchangeListener#onMessageExchange(
> >> >> >> javax.jbi.messaging.MessageExchange)
> >> >> >>             */
> >> >> >>            public void onMessageExchange(MessageExchange
> exchange)
> >> >> throws
> >> >> >> MessagingException {
> >> >> >>
> >> >> >>                NormalizedMessage message = exchange.getMessage
> >> ("in");
> >> >> >>                        if (message == null) {
> >> >> >>                                log.warn("Received null message
> from
> >> >> >> exchange: " + exchange);
> >> >> >>                        } else {
> >> >> >>                                log.info("Exchange: " + exchange +
> "
> >> >> >> received IN message: "
> >> >> >>                                                + message);
> >> >> >>                                try {
> >> >> >>                                        log.info("Body is: "
> >> >> >>                                                        +
> >> >> >> sourceTransformer.toString(message.getContent()));
> >> >> >>                                } catch (TransformerException e) {
> >> >> >>                                        log.error("Failed to turn
> >> >> message
> >> >> >> body into text: " + e, e);
> >> >> >>                                }
> >> >> >>                        }
> >> >> >>                        done(exchange);
> >> >> >>                        log.info("MESSAGGIO RICEVUTO");
> >> >> >>
> >> >> >>                  log.info("COPIO IL PACCHETTO");
> >> >> >>
> >> >> >>                        MessageExchange scambio =
> >> >> >> (MessageExchange)exchange;
> >> >> >>                        log.info("IL PACCHETTO COPIATO E': "
> >> +scambio);
> >> >> >>
> >> >> >>
> >> >> >>                if (exchange.getStatus() != ExchangeStatus.DONE) {
> >> >> >>                        log.info("RITORNA PERCHE' LO STATO E': "
> >> >> >> +exchange.getStatus());
> >> >> >>                    return;
> >> >> >>                }
> >> >> >>                // This is a notification from the WSN broker
> >> >> >>                if
> >> >> >>
> >> >>
> >> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
> >> >> {
> >> >> >>                    try {
> >> >> >>                        JAXBContext jaxbContext =
> >> >> >> JAXBContext.newInstance(Subscribe.class);
> >> >> >>                        Source src = exchange.getMessage
> >> >> >> ("in").getContent();
> >> >> >>                        Object input =
> >> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
> >> >> >>                        if (input instanceof Subscribe) {
> >> >> >>                            subscription = (Subscribe) input;
> >> >> >>                            SubscribeResponse response = new
> >> >> >> SubscribeResponse();
> >> >> >>                            String wsaAddress =
> >> >> >> getService().getNamespaceURI() +
> >> >> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
> >> >> >>
> >> >> >> response.setSubscriptionReference(AbstractWSAClient.createWSA
> >> >> >> (wsaAddress));
> >> >> >>                            StringWriter writer = new
> >> StringWriter();
> >> >> >>                            jaxbContext.createMarshaller
> >> >> >> ().marshal(response,
> >> >> >> writer);
> >> >> >>                            NormalizedMessage out =
> >> >> exchange.createMessage
> >> >> >> ();
> >> >> >>                            out.setContent(new
> >> >> >> StringSource(writer.toString
> >> >> >> ()));
> >> >> >>                            exchange.setMessage(out, "out");
> >> >> >>                            send(exchange);
> >> >> >>
> >> >> >>                        } else if (input instanceof Unsubscribe) {
> >> >> >>                            subscription = null;
> >> >> >>                            UnsubscribeResponse response = new
> >> >> >> UnsubscribeResponse();
> >> >> >>                            StringWriter writer = new
> >> StringWriter();
> >> >> >>                            jaxbContext.createMarshaller
> >> >> >> ().marshal(response,
> >> >> >> writer);
> >> >> >>                            NormalizedMessage out =
> >> >> exchange.createMessage
> >> >> >> ();
> >> >> >>                            out.setContent(new
> >> >> >> StringSource(writer.toString
> >> >> >> ()));
> >> >> >>                            exchange.setMessage(out, "out");
> >> >> >>                            send(exchange);
> >> >> >>
> >> >> >>
> >> >> >>                        } else {
> >> >> >>                            throw new Exception("Unkown request");
> >> >> >>                        }
> >> >> >>                    } catch (Exception e) {
> >> >> >>                        fail(exchange, e);
> >> >> >>                    }
> >> >> >>                // This is a notification to publish
> >> >> >>                }
> >> >> >>
> >> >> >>                  else {
> >> >> >>                    try {
> >> >> >>                        if (!demand || subscription != null) {
> >> >> >>                            Element elem = new
> >> >> >> SourceTransformer().toDOMElement(exchange.getMessage("in"));
> >> >> >>                            wsnBroker.notify(receiveTopic, elem);
> >> >> >>                            done(exchange);
> >> >> >>                        } else {
> >> >> >>                            log.info("Ingore notification as the
> >> >> publisher
> >> >> >> is no
> >> >> >> subscribers");
> >> >> >>                        }
> >> >> >>                    } catch (Exception e) {
> >> >> >>                        fail(exchange, e);
> >> >> >>                        }
> >> >> >>                }
> >> >> >>            }
> >> >> >>
> >> >> >>  }
> >> >> >>
> >> >> >>  ......
> >> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >> >> >> DEBUG - JMSFlow                        - Called Flow send
> >> >> >> DEBUG - ActiveMQSession                - Sending message:
> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> >> >> messageId
> >> >> >> =
> >> >> >> ID:martina-39597-1199704995676-3:0:1:1:5, originalDestination =
> >> null,
> >> >> >> originalTransactionId = null, producerId =
> >> >> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
> >> >> >> queue://org.apache.servicemix.jms.{
> >> >> >>
> >> >>
> >> http://servicemix.apache.org/demo}trace:endpoint<http://servicemix.apache.org/demo%7Dtrace:endpoint>
> <http://servicemix.apache.org/demo%7Dtrace:endpoint>
> >> <http://servicemix.apache.org/demo%7Dtrace:endpoint>
> >> >> <http://servicemix.apache.org/demo%7Dtrace:endpoint>
> >> >> >> ,
> >> >> >> transactionId = null, expiration = 0, timestamp = 1199705011173,
> >> >> arrival
> >> >> >> =
> >> >> >> 0, correlationId = null, replyTo = null, persistent = true, type
> =
> >> >> null,
> >> >> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId
> =
> >> >> null,
> >> >> >> compressed = false, userID = null, content =
> >> >> >> org.apache.activemq.util.ByteSequence@10a69f0,
> marshalledProperties
> >> =
> >> >> >> null,
> >> >> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties
> =
> >> >> null,
> >> >> >> readOnlyProperties = true, readOnlyBody = true, droppable =
> false}
> >> >> >> INFO  - SubscriberComponent            - Exchange: InOnly[
> >> >> >>  id: ID:192.168.0.172-11753fdefba-2:0
> >> >> >>  status: Active
> >> >> >>  role: provider
> >> >> >>  endpoint: endpoint
> >> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> >> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> >> >> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >> >> >>
> >> >>
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing
> "><name>My
> >> >> >> Example
> >> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.MyExample
> >> >> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
> >> >> >>
> >> >> >>
> >> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> >> >> ] received IN message:
> >> >> >>
> >> >> >>
> >> >>
> >>
> org.apache.servicemix.jbi.messaging.NormalizedMessageImpl@b125bd{properties
> >> >> >> :
> >> >> >> {}}
> >> >> >> INFO  - SubscriberComponent            - Body is: <?xml
> >> version="1.0
> >> "
> >> >> >> encoding="UTF-8"?><ns2:Notify xmlns:ns2="
> >> >> >> http://docs.oasis-open.org/wsn/b-2"
> >> >> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >> >> >>
> >> >>
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing
> "><name>My
> >> >> >> Example
> >> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.MyExample
> >> >> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
> >> >> >>
> >> >> >>
> >> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
> >> >> status
> >> >> =
> >> >> >> getStatus()
> >> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E
> CAMBIA
> >> LO
> >> >> >> STATO
> >> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> me.handleSend(sync)
> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> >> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >> >> >> DEBUG - JMSFlow                        - Called Flow send
> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
> >> >> >> container.sendExchange(mirror);
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> >> >> >> DEBUG - ActiveMQSession                - Sending message:
> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> >> >> messageId
> >> >> >> =
> >> >> >> ID:martina-39597-1199704995676-3:0:1:1:6, originalDestination =
> >> null,
> >> >> >> originalTransactionId = null, producerId =
> >> >> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
> >> >> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
> >> >> expiration
> >> >> >> =
> >> >> >> 0, timestamp = 1199705011183, arrival = 0, correlationId = null,
> >> >> replyTo
> >> >> >> =
> >> >> >> null, persistent = true, type = null, priority = 4, groupID =
> null,
> >> >> >> groupSequence = 0, targetConsumerId = null, compressed = false,
> >> userID
> >> >> =
> >> >> >> null, content = org.apache.activemq.util.ByteSequence@c70f32,
> >> >> >> marshalledProperties = null, dataStructure = null,
> >> redeliveryCounter
> >> =
> >> >> 0,
> >> >> >> size = 0, properties = null, readOnlyProperties = true,
> >> readOnlyBody
> >> =
> >> >> >> true,
> >> >> >> droppable = false}
> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
> >> >> >> container.sendExchange(mirror);
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> >> >> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> >> >> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> >> >> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
> >> >> InOnly[
> >> >> >>  id: ID:192.168.0.172-11753fdefba-2:0
> >> >> >>  status: Done
> >> >> >>  role: provider
> >> >> >>  endpoint: endpoint
> >> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> >> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> >> >> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >> >> >>
> >> >>
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing
> "><name>My
> >> >> >> Example
> >> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.MyExample
> >> >> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
> >> >> >>
> >> >> >>
> >> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> >> >> ]
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
> >> >> status
> >> >> =
> >> >> >> getStatus()
> >> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E
> CAMBIA
> >> LO
> >> >> >> STATO
> >> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> me.handleSend(sync)
> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> >> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >> >> >> DEBUG - JMSFlow                        - Called Flow send
> >> >> >> DEBUG - WSNSpringComponent             - Received exchange:
> status:
> >> >> Done,
> >> >> >> role: consumer
> >> >> >> DEBUG - WSNSpringComponent             - Retrieved correlation
> id:
> >> >> null
> >> >> >> DEBUG - ActiveMQSession                - Sending message:
> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> >> >> messageId
> >> >> >> =
> >> >> >> ID:martina-39597-1199704995676-3:0:1:1:7, originalDestination =
> >> null,
> >> >> >> originalTransactionId = null, producerId =
> >> >> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
> >> >> >> queue://org.apache.servicemix.jms.{
> >> >> >>
> >> >>
> >> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> >> >> ,
> >> >> >> transactionId = null, expiration = 0, timestamp = 1199705011188,
> >> >> arrival
> >> >> >> =
> >> >> >> 0, correlationId = null, replyTo = null, persistent = true, type
> =
> >> >> null,
> >> >> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId
> =
> >> >> null,
> >> >> >> compressed = false, userID = null, content =
> >> >> >> org.apache.activemq.util.ByteSequence@1c8f59c,
> marshalledProperties
> >> =
> >> >> >> null,
> >> >> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties
> =
> >> >> null,
> >> >> >> readOnlyProperties = true, readOnlyBody = true, droppable =
> false}
> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
> >> >> >> container.sendExchange(mirror);
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> ERROR - JMSFlow                        - Caught an exception
> >> routing
> >> >> >> ExchangePacket:
> >> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
> >> >> sendSync
> >> >> >>        at
> >> >> >>
> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> >> >> >> MessageExchangeImpl.java:581)
> >> >> >>        at
> >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> >> >> >> DeliveryChannelImpl.java:384)
> >> >> >>        at
> >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> >> >> >> DeliveryChannelImpl.java:444)
> >> >> >>        at
> >> >> >>
> >> >>
> >> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
> >> >> >> :249)
> >> >> >>        at
> >> >> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> >> >> >> SubscriberComponent.java:203)
> >> >> >>        at
> >> >> >>
> >> >>
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> >> >> >> DeliveryChannelImpl.java:621)
> >> >> >>        at
> >> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> >> >> >> AbstractFlow.java:174)
> >> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3
> (
> >> >> >> JMSFlow.java:1)
> >> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
> >> >> >> JMSFlow.java:543)
> >> >> >>        at
> >> >> >>
> >> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> >> >> >> (ThreadPoolExecutor.java:665)
> >> >> >>        at
> >> >> >>
> >> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> >> >> >> (ThreadPoolExecutor.java:690)
> >> >> >>        at java.lang.Thread.run(Thread.java:595)
> >> >> >>
> >> >> >> Can you help me again?
> >> >> >> Thanks in advance!
> >> >> >>
> >> >> >> Martina
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> gnodet wrote:
> >> >> >> >
> >> >> >> > You need to use an InOnly or RobustInOnly exchange, not an
> InOut
> >> >> >> exchange,
> >> >> >> > as notifications do not have any out messages.
> >> >> >> >
> >> >> >> > On Jan 4, 2008 5:16 PM, martymusk <ma...@email.it> wrote:
> >> >> >> >
> >> >> >> >>
> >> >> >> >> Thus , I've created a new class "SubscriberComponent" that is
> a
> >> >> copy
> >> >> >> of
> >> >> >> >> PublisherComponent. Trhough it instance2 receive exchange and
> >> try
> >> >> to
> >> >> >> send
> >> >> >> >> scambio (copy of exchange). When I run example the following
> >> error
> >> >> >> >> occurs...
> >> >> >> >>
> >> >> >> >> DEBUG - JMSFlow                        - Called Flow send
> >> >> >> >> DEBUG - ActiveMQSession                - Sending message:
> >> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired =
> false,
> >> >> >> messageId
> >> >> >> >> =
> >> >> >> >> ID:martina-38529-1199462112612-3:0:1:1:6, originalDestination
> =
> >> >> null,
> >> >> >> >> originalTransactionId = null, producerId =
> >> >> >> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
> >> >> >> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
> >> >> >> expiration
> >> >> >> >> =
> >> >> >> >> 0, timestamp = 1199462153935, arrival = 0, correlationId =
> null,
> >> >> >> replyTo
> >> >> >> >> =
> >> >> >> >> null, persistent = true, type = null, priority = 4, groupID =
> >> null,
> >> >> >> >> groupSequence = 0, targetConsumerId = null, compressed =
> false,
> >> >> userID
> >> >> >> =
> >> >> >> >> null, content = org.apache.activemq.util.ByteSequence@b2175,
> >> >> >> >> marshalledProperties = null, dataStructure = null,
> >> >> redeliveryCounter
> >> >> =
> >> >> >> 0,
> >> >> >> >> size = 0, properties = null, readOnlyProperties = true,
> >> >> readOnlyBody
> >> >> =
> >> >> >> >> true,
> >> >> >> >> droppable = false}
> >> >> >> >> DEBUG - WSNSpringComponent             - Received exchange:
> >> status:
> >> >> >> >> Active,
> >> >> >> >> role: consumer
> >> >> >> >> DEBUG - WSNSpringComponent             - Retrieved correlation
> >> id:
> >> >> >> null
> >> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
> >> >> >> >> container.sendExchange(mirror);
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> >> >> >> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> >> >> >> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> >> >> >> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO
> >> E':
> >> >> >> InOut[
> >> >> >> >>  id: ID:192.168.0.172-1174583cdf9-2:0
> >> >> >> >>  status: Active
> >> >> >> >>  role: provider
> >> >> >> >>  endpoint: endpoint
> >> >> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> >> >> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> >> >> >> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> >> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> >> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> >> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing
> >> "><name>My
> >> >> >> >> Example
> >> >> >> >>
> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.MyExample
> >> >> >> >> Job</fullname><description/><fireTime>Fri Jan 04 16:55:53 CET
> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> >> >> >> ]
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
> >> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
> >> LISTNERS
> >> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> >> >> INFO  - MessageExchangeImpl            - PRIMA DI
> ExchangeStatus
> >> >> >> status
> >> >> >> =
> >> >> >> >> getStatus()
> >> >> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E
> >> CAMBIA
> >> >> LO
> >> >> >> >> STATO
> >> >> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
> >> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> >> me.handleSend(sync)
> >> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> >> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> >> >> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >> >> >> >> DEBUG - JMSFlow                        - Called Flow send
> >> >> >> >> DEBUG - ActiveMQSession                - Sending message:
> >> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired =
> false,
> >> >> >> messageId
> >> >> >> >> =
> >> >> >> >> ID:martina-38529-1199462112612-3:0:1:1:7, originalDestination
> =
> >> >> null,
> >> >> >> >> originalTransactionId = null, producerId =
> >> >> >> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
> >> >> >> >> queue://org.apache.servicemix.jms.{
> >> >> >> >>
> >> >> >>
> >> >>
> >> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> >> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker
> >
> >> >> >> >> ,
> >> >> >> >> transactionId = null, expiration = 0, timestamp =
> 1199462153952,
> >> >> >> arrival
> >> >> >> >> =
> >> >> >> >> 0, correlationId = null, replyTo = null, persistent = true,
> type
> >> =
> >> >> >> null,
> >> >> >> >> priority = 4, groupID = null, groupSequence = 0,
> >> targetConsumerId
> >> =
> >> >> >> null,
> >> >> >> >> compressed = false, userID = null, content =
> >> >> >> >> org.apache.activemq.util.ByteSequence@779b3e,
> >> marshalledProperties
> >> >> =
> >> >> >> >> null,
> >> >> >> >> dataStructure = null, redeliveryCounter = 0, size = 0,
> >> properties
> >> =
> >> >> >> null,
> >> >> >> >> readOnlyProperties = true, readOnlyBody = true, droppable =
> >> false}
> >> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
> >> >> >> >> container.sendExchange(mirror);
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E'
> CHIUSO
> >> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
> >> LISTNERS
> >> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E'
> CHIUSO
> >> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
> >> LISTNERS
> >> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> >> ERROR - JMSFlow                        - Caught an exception
> >> >> routing
> >> >> >> >> ExchangePacket:
> >> >> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
> >> >> >> sendSync
> >> >> >> >>        at
> >> >> >> >>
> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> >> >> >> >> MessageExchangeImpl.java:581)
> >> >> >> >>        at
> >> >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend
> (
> >> >> >> >> DeliveryChannelImpl.java:384)
> >> >> >> >>        at
> >> >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> >> >> >> >> DeliveryChannelImpl.java:444)
> >> >> >> >>        at
> >> >> >> >>
> >> >> >>
> >> >>
> >> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
> >> >> >> >> :249)
> >> >> >> >>        at
> >> >> >> >>
> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> >> >> >> >> SubscriberComponent.java:203)
> >> >> >> >>        at
> >> >> >> >>
> >> >> >>
> >> >>
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> >> >> >> >> DeliveryChannelImpl.java:621)
> >> >> >> >>        at
> >> >> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> >> >> >> >> AbstractFlow.java:174)
> >> >> >> >>        at
> >> org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3
> >> (
> >> >> >> >> JMSFlow.java:1)
> >> >> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run
> (
> >> >> >> >> JMSFlow.java:543)
> >> >> >> >>        at
> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> >> >> >> >> (ThreadPoolExecutor.java:665)
> >> >> >> >>        at
> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> >> >> >> >> (ThreadPoolExecutor.java:690)
> >> >> >> >>        at java.lang.Thread.run(Thread.java:595)
> >> >> >> >>
> >> >> >> >> I do wrong again?
> >> >> >> >>
> >> >> >> >> Thank you!!!
> >> >> >> >> Martina
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> gnodet wrote:
> >> >> >> >> >
> >> >> >> >> > You should have a look at the existing code:
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/spring/PublisherComponent.java?r=602828
> >> >> >> >> >
> >> >> >> >> > Note that the publisher component actually use the client
> api
> >> >> (line
> >> >> >> >> 172).
> >> >> >> >> > For details on thow the client api works (which is how to
> send
> >> a
> >> >> JBI
> >> >> >> >> > exchange to the WSN broker), see:
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >>
> >> >>
> >>
> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/client/NotificationBroker.java?r=602828#l89
> >> >> >> >> >
> >> >> >> >> > I would advise you to start from the publisher component,
> copy
> >> it
> >> >> >> and
> >> >> >> >> use
> >> >> >> >> > it
> >> >> >> >> > instead of your TraceComponent.
> >> >> >> >> > Each time it receives a JBI exchange, it will publish it
> >> through
> >> >> the
> >> >> >> >> > WSNotification broker.
> >> >> >> >> >
> >> >> >> >> > Also look at the various resources on the web site that may
> >> help
> >> >> >> you:
> >> >> >> >> >   http://servicemix.apache.org/servicemix-wsn2005.html
> >> >> >> >> >   http://servicemix.apache.org/example-scenario.html
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > On Jan 4, 2008 2:58 PM, martymusk <ma...@email.it>
> wrote:
> >> >> >> >> >
> >> >> >> >> >>
> >> >> >> >> >> Hy gnodet and thank you very much for your helpfulness,
> >> >> >> >> >> but I don't understand exactly what I must to do.
> >> >> >> >> >>
> >> >> >> >> >> How can I send JBI exchange to the WSN broker directly?
> >> >> >> >> >> How can I use WSN client api.
> >> >> >> >> >>
> >> >> >> >> >> I'm working for a thesis at University of Naples.
> >> >> >> >> >> My purpose is to study WSN performance.
> >> >> >> >> >> I've found your WSN implementation very useful for me, but
> to
> >> >> study
> >> >> >> >> >> performance, I need exchange was send back.
> >> >> >> >> >> It is more than a mounth I'm triyng to do this.
> >> >> >> >> >>
> >> >> >> >> >> I would be very grateful if you can help me. Otherwise,
> there
> >> >> are
> >> >> >> no
> >> >> >> >> >> problems, I'll keep on study over and over again, hoping I
> be
> >> >> able
> >> >> >> to
> >> >> >> >> >> achieve my purpose.
> >> >> >> >> >>
> >> >> >> >> >> Thank you very much.
> >> >> >> >> >> Martina
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> gnodet wrote:
> >> >> >> >> >> >
> >> >> >> >> >> > I thought I pointed you to the right direction.
> >> >> >> >> >> > Do not use the PublisherComponent that way: either use it
> >> as
> >> >> it
> >> >> >> is
> >> >> >> >> >> > intended
> >> >> >> >> >> > (deploy it as a component onto the lightweight container)
> >> or
> >> >> use
> >> >> >> the
> >> >> >> >> >> WSN
> >> >> >> >> >> > client api:
> >> >> >> >> >> >    wsn.notify(topic, msg)
> >> >> >> >> >> >
> >> >> >> >> >> > I'm not sure what you are trying to achieve with your
> >> >> >> >> TraceComponent.
> >> >> >> >> >>  It
> >> >> >> >> >> > sounds like you want to reimplement the
> PublisherComponent.
> >> >> If
> >> >> >> so,
> >> >> >> >> you
> >> >> >> >> >> > should have a look at how it is implemented and patch it.
> >> >> >> >> >> >
> >> >> >> >> >> > Also note that both PublisherComponent and the WSN client
> >> api
> >> >> are
> >> >> >> >> just
> >> >> >> >> >> > sugar, you can send a JBI exchange to the WSN broker
> >> directly
> >> >> if
> >> >> >> you
> >> >> >> >> >> want.
> >> >> >> >> >> >
> >> >> >> >> >> > On Jan 4, 2008 2:13 PM, martymusk <ma...@email.it>
> >> wrote:
> >> >> >> >> >> >
> >> >> >> >> >> >>
> >> >> >> >> >> >> My problem is always the same!
> >> >> >> >> >> >> In wsn-example, after Consumer received an exchange, I'd
> >> like
> >> >> it
> >> >> >> >> send
> >> >> >> >> >> >> copy
> >> >> >> >> >> >> of it. But it doesn't happen. :-(
> >> >> >> >> >> >> I've modified TraceComponent class in the following way,
> >> but
> >> >> it
> >> >> >> >> >> doesn't
> >> >> >> >> >> >> work
> >> >> >> >> >> >> fine:
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >> package org.apache.servicemix.wsn;
> >> >> >> >> >> >>
> >> >> >> >> >> >> import java.io.StringWriter;
> >> >> >> >> >> >>
> >> >> >> >> >> >> import javax.jbi.JBIException;
> >> >> >> >> >> >> import javax.jbi.messaging.ExchangeStatus;
> >> >> >> >> >> >> import javax.jbi.messaging.MessageExchange;
> >> >> >> >> >> >> import javax.jbi.messaging.MessagingException;
> >> >> >> >> >> >> import javax.jbi.messaging.NormalizedMessage;
> >> >> >> >> >> >> import javax.xml.bind.JAXBContext;
> >> >> >> >> >> >> import javax.xml.transform.Source;
> >> >> >> >> >> >> import javax.xml.transform.TransformerException;
> >> >> >> >> >> >> //import javax.jbi.messaging.InOut;
> >> >> >> >> >> >>
> >> >> >> >> >> >> import
> >> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl
> >> >> ;
> >> >> >> >> >> >> import org.apache.servicemix.jbi.messaging.InOutImpl;
> >> >> >> >> >> >> import org.apache.commons.logging.Log;
> >> >> >> >> >> >> import org.apache.commons.logging.LogFactory;
> >> >> >> >> >> >> import org.apache.servicemix.MessageExchangeListener;
> >> >> >> >> >> >> import
> >> >> org.apache.servicemix.components.util.ComponentSupport;
> >> >> >> >> >> >> import
> >> org.apache.servicemix.wsn.spring.PublisherComponent;
> >> >> >> >> >> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
> >> >> >> >> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
> >> >> >> >> >> >> import
> org.apache.servicemix.wsn.client.AbstractWSAClient;
> >> >> >> >> >> >> import
> >> org.apache.servicemix.wsn.client.NotificationBroker;
> >> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
> >> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
> >> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
> >> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
> >> >> >> >> >> >> import org.w3c.dom.Element;
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >> public class TraceComponent extends ComponentSupport
> >> >> implements
> >> >> >> >> >> >>                MessageExchangeListener {
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >>        private Log log =
> >> >> >> LogFactory.getLog(TraceComponent.class);
> >> >> >> >> >> >>
> >> >> >> >> >> >>        private SourceTransformer sourceTransformer = new
> >> >> >> >> >> >> SourceTransformer();
> >> >> >> >> >> >>
> >> >> >> >> >> >>        public Log getLog() {
> >> >> >> >> >> >>                return log;
> >> >> >> >> >> >>        }
> >> >> >> >> >> >>
> >> >> >> >> >> >>        public void setLog(Log log) {
> >> >> >> >> >> >>                this.log = log;
> >> >> >> >> >> >>        }
> >> >> >> >> >> >>
> >> >> >> >> >> >>        public SourceTransformer getSourceTransformer() {
> >> >> >> >> >> >>                return sourceTransformer;
> >> >> >> >> >> >>        }
> >> >> >> >> >> >>
> >> >> >> >> >> >>        public void
> setSourceTransformer(SourceTransformer
> >> >> >> >> >> >> sourceTransformer) {
> >> >> >> >> >> >>                this.sourceTransformer =
> sourceTransformer;
> >> >> >> >> >> >>        }
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >>        //AGGIUNGO CODICE
> >> >> >> >> >> >>
> >> >> >> >> >> >>        PublisherComponent publisher = new
> >> >> PublisherComponent();
> >> >> >> >> >> >>          private String subscriptionEndpoint =
> >> >> "subscription";
> >> >> >> >> >> >>          private NotificationBroker wsnBroker;
> >> >> >> >> >> >>          private String topic;
> >> >> >> >> >> >>          private String msg;
> >> >> >> >> >> >>          private boolean demand;
> >> >> >> >> >> >>          private Subscribe subscription;
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >>          public String getTopic() {
> >> >> >> >> >> >>                return topic;
> >> >> >> >> >> >>            }
> >> >> >> >> >> >>
> >> >> >> >> >> >>            /**
> >> >> >> >> >> >>             * @param topic The topic to set.
> >> >> >> >> >> >>             */
> >> >> >> >> >> >>            public void setTopic(String topic) {
> >> >> >> >> >> >>               this.topic = topic;
> >> >> >> >> >> >>            }
> >> >> >> >> >> >>
> >> >> >> >> >> >>         public void init() throws JBIException {
> >> >> >> >> >> >>                super.init();
> >> >> >> >> >> >>
>  getContext().activateEndpoint(getService(),
> >> >> >> >> >> >> subscriptionEndpoint);
> >> >> >> >> >> >>                 log.info("METODO INIT");
> >> >> >> >> >> >>                // publisher.init();
> >> >> >> >> >> >>
> >> >> >> >> >> >>                 publisher.setTopic(topic);
> >> >> >> >> >> >>            }
> >> >> >> >> >> >>
> >> >> >> >> >> >>            /* (non-Javadoc)
> >> >> >> >> >> >>             * @see
> >> >> javax.jbi.management.LifeCycleMBean#start()
> >> >> >> >> >> >>             */
> >> >> >> >> >> >>            public void start() throws JBIException {
> >> >> >> >> >> >>
> >> >> >> >> >> >>                log.info("METODO START");
> >> >> >> >> >> >>                //publisher.start();
> >> >> >> >> >> >>                new Thread() {
> >> >> >> >> >> >>                  public void run() {
> >> >> >> >> >> >>                       try {
> >> >> >> >> >> >>                           wsnBroker = new
> >> >> >> >> >> >> NotificationBroker(getContext());
> >> >> >> >> >> >>
> >> >> >> >> >> >>                           String wsaAddress =
> >> >> >> >> >> >> getService().getNamespaceURI() + "/"
> >> >> >> >> >> >> + getService().getLocalPart() + "/" +
> >> subscriptionEndpoint;
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >>
> >> >> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
> >> >> >> >> >> >>
> >> topic,
> >> >> >> >> >> >>
> >> >>  demand);
> >> >> >> >> >> >>                        } catch (Exception e) {
> >> >> >> >> >> >>                            log.error("Could not create
> wsn
> >> >> >> client",
> >> >> >> >> >> e);
> >> >> >> >> >> >>                        }
> >> >> >> >> >> >>                    }
> >> >> >> >> >> >>                }.start();
> >> >> >> >> >> >>            }
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >>            public void shutDown() throws JBIException {
> >> >> >> >> >> >>                log.info("METODO SHUTDOWN");
> >> >> >> >> >> >>            //  publisher.shutDown();
> >> >> >> >> >> >>               super.shutDown();
> >> >> >> >> >> >>            }
> >> >> >> >> >> >>
> >> >> >> >> >> >>            //FINE CODICE AGGIUNTO
> >> >> >> >> >> >>
> >> >> >> >> >> >>        public void onMessageExchange(MessageExchange
> >> >> exchange)
> >> >> >> >> >> >>                        throws MessagingException {
> >> >> >> >> >> >>                // lets dump the incoming message
> >> >> >> >> >> >>                NormalizedMessage message =
> >> >> exchange.getMessage
> >> >> >> >> ("in");
> >> >> >> >> >> >>                if (message == null) {
> >> >> >> >> >> >>                        log.warn("Received null message
> >> from
> >> >> >> >> exchange:
> >> >> >> >> >> "
> >> >> >> >> >> +
> >> >> >> >> >> >> exchange);
> >> >> >> >> >> >>                } else {
> >> >> >> >> >> >>                        log.info("Exchange: " + exchange
> +
> >> "
> >> >> >> >> received
> >> >> >> >> >> IN
> >> >> >> >> >> >> message: "
> >> >> >> >> >> >>                                        + message);
> >> >> >> >> >> >>                        try {
> >> >> >> >> >> >>                                log.info("Body is: "
> >> >> >> >> >> >>                                                +
> >> >> >> >> >> >> sourceTransformer.toString(message.getContent()));
> >> >> >> >> >> >>                        } catch (TransformerException e)
> {
> >> >> >> >> >> >>                                log.error("Failed to turn
> >> >> message
> >> >> >> >> body
> >> >> >> >> >> >> into
> >> >> >> >> >> >> text: " + e, e);
> >> >> >> >> >> >>                        }
> >> >> >> >> >> >>                }
> >> >> >> >> >> >>                done(exchange);
> >> >> >> >> >> >>                log.info("MESSAGGIO RICEVUTO");
> >> >> >> >> >> >>
> >> >> >> >> >> >>                log.info("COPIO IL PACCHETTO");
> >> >> >> >> >> >>
> >> >> >> >> >> >>                MessageExchange scambio =
> >> >> >> (MessageExchange)exchange;
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >>                log.info("INVIO");
> >> >> >> >> >> >>
> >> >> >> >> >> >>          try{
> >> >> >> >> >> >>
> >> >> >> >> >> >>                log.info("FASE INVIO");
> >> >> >> >> >> >>                //publisher.onMessageExchange(scambio);
> >> >> >> >> >> >>
> >> >> >> >> >> >>                //AGGIUNGO onMessageExchange
> >> >> >> >> >> >>
> >> >> >> >> >> >>                if (exchange.getStatus() !=
> >> >> >> ExchangeStatus.ACTIVE)
> >> >> >> {
> >> >> >> >> >> >>                    return;
> >> >> >> >> >> >>                }
> >> >> >> >> >> >>                // This is a notification from the WSN
> >> broker
> >> >> >> >> >> >>                if
> >> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
> >> >> >> >> >> {
> >> >> >> >> >> >>                    try {
> >> >> >> >> >> >>                        JAXBContext jaxbContext =
> >> >> >> >> >> >> JAXBContext.newInstance(Subscribe.class);
> >> >> >> >> >> >>                        Source src = exchange.getMessage
> >> >> >> >> >> >> ("in").getContent();
> >> >> >> >> >> >>                        Object input =
> >> >> >> >> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
> >> >> >> >> >> >>                        if (input instanceof Subscribe) {
> >> >> >> >> >> >>                            subscription = (Subscribe)
> >> input;
> >> >> >> >> >> >>                            SubscribeResponse response =
> >> new
> >> >> >> >> >> >> SubscribeResponse();
> >> >> >> >> >> >>                            String wsaAddress =
> >> >> >> >> >> >> getService().getNamespaceURI() +
> >> >> >> >> >> >> "/" + getService().getLocalPart() + "/" +
> >> >> subscriptionEndpoint;
> >> >> >> >> >> >>
> >> >> >> >> >> >> response.setSubscriptionReference(
> >> AbstractWSAClient.createWSA
> >> >> >> >> >> >> (wsaAddress));
> >> >> >> >> >> >>                            StringWriter writer = new
> >> >> >> >> StringWriter();
> >> >> >> >> >> >>                            jaxbContext.createMarshaller
> >> >> >> >> >> >> ().marshal(response,
> >> >> >> >> >> >> writer);
> >> >> >> >> >> >>                            NormalizedMessage out =
> >> >> >> >> >> exchange.createMessage
> >> >> >> >> >> >> ();
> >> >> >> >> >> >>                            out.setContent(new
> >> >> >> >> >> >> StringSource(writer.toString
> >> >> >> >> >> >> ()));
> >> >> >> >> >> >>                            exchange.setMessage(out,
> >> "out");
> >> >> >> >> >> >>                            send(exchange);
> >> >> >> >> >> >>
> >> >> >> >> >> >>                        } else if (input instanceof
> >> >> Unsubscribe)
> >> >> >> {
> >> >> >> >> >> >>                            subscription = null;
> >> >> >> >> >> >>                            UnsubscribeResponse response
> =
> >> new
> >> >> >> >> >> >> UnsubscribeResponse();
> >> >> >> >> >> >>                            StringWriter writer = new
> >> >> >> >> StringWriter();
> >> >> >> >> >> >>                            jaxbContext.createMarshaller
> >> >> >> >> >> >> ().marshal(response,
> >> >> >> >> >> >> writer);
> >> >> >> >> >> >>                            NormalizedMessage out =
> >> >> >> >> >> exchange.createMessage
> >> >> >> >> >> >> ();
> >> >> >> >> >> >>                            out.setContent(new
> >> >> >> >> >> >> StringSource(writer.toString
> >> >> >> >> >> >> ()));
> >> >> >> >> >> >>                            exchange.setMessage(out,
> >> "out");
> >> >> >> >> >> >>                            send(exchange);
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >>                        } else {
> >> >> >> >> >> >>                            throw new Exception("Unkown
> >> >> >> request");
> >> >> >> >> >> >>                        }
> >> >> >> >> >> >>                    } catch (Exception e) {
> >> >> >> >> >> >>                        fail(exchange, e);
> >> >> >> >> >> >>                    }
> >> >> >> >> >> >>                // This is a notification to publish
> >> >> >> >> >> >>                }
> >> >> >> >> >> >>
> >> >> >> >> >> >>                  else {
> >> >> >> >> >> >>                    try {
> >> >> >> >> >> >>
> >> >> >> >> >> >>                    log.info("SALTA");
> >> >> >> >> >> >>                        if (!demand || subscription !=
> >> null)
> >> {
> >> >> >> >> >> >>                                log.info("ENTRO
> NELL'IF");
> >> >> >> >> >> >>                           // Element elem = new
> >> >> >> >> >> >> SourceTransformer().toDOMElement(exchange.getMessage
> >> ("in"));
> >> >> >> >> >> >>                            log.info("PRIMA DI
> WSNBROKER");
> >> >> >> >> >> >>                            wsnBroker.notify(topic, msg);
> >> >> >> >> >> >>                            log.info("PRIMA DI DONE");
> >> >> >> >> >> >>
> >> >>  getDeliveryChannel().send(exchange);
> >> >> >> >> >> >>                            log.info("DOPO DI DONE");
> >> >> >> >> >> >>                        } else {
> >> >> >> >> >> >>                            log.info("Ingore notification
> >> as
> >> >> the
> >> >> >> >> >> publisher
> >> >> >> >> >> >> is no
> >> >> >> >> >> >> subscribers");
> >> >> >> >> >> >>                        }
> >> >> >> >> >> >>                    } catch (Exception e) {
> >> >> >> >> >> >>                        fail(exchange, e);
> >> >> >> >> >> >>                        }
> >> >> >> >> >> >>
> >> >> >> >> >> >>                log.debug("IL PACCHETTO INVIATO E': " +
> >> >> scambio);
> >> >> >> >> >> >>
> >> >> >> >> >> >>                  }
> >> >> >> >> >> >>                //FINE onMessageExchange
> >> >> >> >> >> >>
> >> >> >> >> >> >>           } catch(JBIException e){
> >> >> >> >> >> >>                  log.error("ECCEZIONE GENERATA!");
> >> >> >> >> >> >>          }
> >> >> >> >> >> >>
> >> >> >> >> >> >>      log.info("INVIATO");
> >> >> >> >> >> >> }
> >> >> >> >> >> >> }
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >> Help me if you can.
> >> >> >> >> >> >> Thank you very much for your helpfulness...
> >> >> >> >> >> >>
> >> >> >> >> >> >> Martina
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >> gnodet wrote:
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > You should not have to deal nor see the internal state
> >> of
> >> >> the
> >> >> >> >> >> exchange.
> >> >> >> >> >> >> > If guess you have an exception when trying to send an
> >> >> >> exchange,
> >> >> >> >> but
> >> >> >> >> >> >> this
> >> >> >> >> >> >> > means that there is a problem in your code.  You
> should
> >> >> post
> >> >> a
> >> >> >> >> >> snippet
> >> >> >> >> >> >> of
> >> >> >> >> >> >> > your code that is failing so that we can help you.
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > On Jan 4, 2008 12:22 PM, martymusk <martymusk@email.it
> >
> >> >> wrote:
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >>
> >> >> >> >> >> >> >> Hy,
> >> >> >> >> >> >> >> I've a question...
> >> >> >> >> >> >> >> can I set anywhere Consumer to CAN_SEND?
> >> >> >> >> >> >> >>
> >> >> >> >> >> >> >> I hope you can help me.
> >> >> >> >> >> >> >> Thank you in advance.
> >> >> >> >> >> >> >>
> >> >> >> >> >> >> >> Martina
> >> >> >> >> >> >> >> --
> >> >> >> >> >> >> >> View this message in context:
> >> >> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >>
> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
> >> >> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive
> at
> >> >> >> >> Nabble.com.
> >> >> >> >> >> >> >>
> >> >> >> >> >> >> >>
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >
> >> >> >> >> >> >> > --
> >> >> >> >> >> >> > Cheers,
> >> >> >> >> >> >> > Guillaume Nodet
> >> >> >> >> >> >> > ------------------------
> >> >> >> >> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >
> >> >> >> >> >> >>
> >> >> >> >> >> >> --
> >> >> >> >> >> >> View this message in context:
> >> >> >> >> >> >>
> >> >> >> >>
> >> >>
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616107.html
> >> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
> >> >> >> Nabble.com.
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >> > --
> >> >> >> >> >> > Cheers,
> >> >> >> >> >> > Guillaume Nodet
> >> >> >> >> >> > ------------------------
> >> >> >> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >>
> >> >> >> >> >> --
> >> >> >> >> >> View this message in context:
> >> >> >> >> >>
> >> >> >>
> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616748.html
> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
> >> >> Nabble.com.
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > --
> >> >> >> >> > Cheers,
> >> >> >> >> > Guillaume Nodet
> >> >> >> >> > ------------------------
> >> >> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >> --
> >> >> >> >> View this message in context:
> >> >> >> >>
> >> >>
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14619757.html
> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
> >> Nabble.com.
> >> >> >> >>
> >> >> >> >>
> >> >> >> >
> >> >> >> >
> >> >> >> > --
> >> >> >> > Cheers,
> >> >> >> > Guillaume Nodet
> >> >> >> > ------------------------
> >> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context:
> >> >> >>
> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14663812.html
> >> >> >> Sent from the ServiceMix - User mailing list archive at
> Nabble.com.
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >> > --
> >> >> > Cheers,
> >> >> > Guillaume Nodet
> >> >> > ------------------------
> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14664874.html
> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > Cheers,
> >> > Guillaume Nodet
> >> > ------------------------
> >> > Blog: http://gnodet.blogspot.com/
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14665988.html
> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> > ------------------------
> > Blog: http://gnodet.blogspot.com/
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14716016.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: Consumer Can Send

Posted by martymusk <ma...@email.it>.
 Please gnodet, 
I've a doubt in my mind...

Can you point me  where consumer creates exchange and call send?
This is the first step of exchange beetwen components, it's right?

But what is the snippet code that make this?
In PublisherComponent class?
I'm unable to identify it.

Can you help me, please?
Thanks in advance

Martina






gnodet wrote:
> 
> You need to understand how exchanges are sent between components.
> For a simple InOnly exchange, it will be the following:
>    * consumer create the exchange and call send
>    * provider receives the exchange (possibly in onMessageExchange)
>    * provide set the done status and call send
>    * consumer receives the exchange in a DONE status
> 
> In your case, the PublisherComponent acts both as a consumer and a
> provider,
> because it receives an exchange and send a copy to the broker, so the
> onMessageExchange will be called multiple times:
>    * first when it receives the first exchange and acts as the provider
> (it
> creates a new exchange and send it by using the WSNotification client api)
>    * then when the exchange comes back with a DONE status
> 
> The log you pasted below is fine but is the second call to the method (you
> can see the DONE status and even the content of the exchange that has been
> previously sent).  Check earlier in your log and you will find what you
> need.
> 
> On Jan 7, 2008 2:39 PM, martymusk <ma...@email.it> wrote:
> 
>>
>> I've tried with original code, and it returns because status is DONE.
>> I post output obtained with original code:
>>
>> DEBUG - WSNSpringComponent             - Received exchange: status: Done,
>> role: consumer
>> DEBUG - WSNSpringComponent             - Retrieved correlation id: null
>> INFO  - DeliveryChannelImpl            - DOPO
>> container.sendExchange(mirror);
>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E': InOnly[
>>  id: ID:192.168.0.172-1175476963a-2:0
>>  status: Done
>>  role: provider
>>  endpoint: endpoint
>>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> xmlns="http://www.w3.org/2005/08/addressing"
>> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> Example
>> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> Job</fullname><description/><fireTime>Mon Jan 07 14:35:12 CET
>>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> ]
>> INFO  - SubscriberComponent            - RETURNS BECAUSE STATUS IS: Done
>>
>> So I've tried to modify ACTIVE with DONE, hoping it carry on, but it
>> fails
>> with error I've posted previously.
>>
>> I don't understand what I do wrong!
>> It's more than a mounth I'm trying to return back exchange. :-(
>>
>> Thank you very much for help you give me!
>>
>> Martina
>>
>>
>>
>> gnodet wrote:
>> >
>> > Have you tried with the original code before modifying the class from
>> > ServiceMix ?
>> > The first lines of the SubscriberComponent#onMessageExchange are
>> >
>> >  if (exchange.getStatus() != ExchangeStatus.ACTIVE) {
>> >      return;
>> >  }
>> >
>> > This is because you have to ignore exchanges in an Error / Done status.
>> > From the code you pasted, it seems you removed those lines and instead
>> do
>> > some copy work and call done() which will fail for exchanges that are
>> not
>> > active.
>> >
>> > You can add debugging statements if you need (debug remoting works fine
>> > too), but please try with the original code first.
>> >
>> > On Jan 7, 2008 1:52 PM, martymusk <ma...@email.it> wrote:
>> >
>> >>
>> >> Thank you very much...
>> >> The exception is the same, I post it:
>> >>
>> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
>> InOnly[
>> >>  id: ID:192.168.0.172-11754495367-2:0
>> >>  status: Done
>> >>  role: provider
>> >>  endpoint: endpoint
>> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> >> Example
>> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> >> Job</fullname><description/><fireTime>Mon Jan 07 13:46:56 CET
>> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> ]
>> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
>> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
>> status
>> =
>> >> getStatus()
>> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
>> >> STATO
>> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> >> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
>> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> DEBUG - JMSFlow                        - Called Flow send
>> >> DEBUG - ActiveMQSession                - Sending message:
>> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> messageId
>> >> =
>> >> ID:martina-39867-1199709997721-3:0:1:1:7, originalDestination = null,
>> >> originalTransactionId = null, producerId =
>> >> ID:martina-39867-1199709997721-3:0:1:1, destination =
>> >> queue://org.apache.servicemix.jms.{
>> >>
>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> ,
>> >> transactionId = null, expiration = 0, timestamp = 1199710016807,
>> arrival
>> >> =
>> >> 0, correlationId = null, replyTo = null, persistent = true, type =
>> null,
>> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
>> null,
>> >> compressed = false, userID = null, content =
>> >> org.apache.activemq.util.ByteSequence@5ac5f, marshalledProperties =
>> null,
>> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
>> null,
>> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
>> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> container.sendExchange(mirror);
>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> ERROR - JMSFlow                        - Caught an exception routing
>> >> ExchangePacket:
>> >> javax.jbi.messaging.MessagingException: illegal call to send /
>> sendSync
>> >>        at
>> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> >> MessageExchangeImpl.java:581)
>> >>        at
>> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>> >> DeliveryChannelImpl.java:384)
>> >>        at
>> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> >> DeliveryChannelImpl.java:444)
>> >>        at
>> >>
>> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
>> >> :249)
>> >>        at
>> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> >> SubscriberComponent.java:204)
>> >>        at
>> >>
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> >> DeliveryChannelImpl.java:621)
>> >>        at
>> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> >> AbstractFlow.java:174)
>> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
>> >> JMSFlow.java:1)
>> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>> >> JMSFlow.java:543)
>> >>        at
>> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> >> (ThreadPoolExecutor.java:665)
>> >>        at
>> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> >> (ThreadPoolExecutor.java:690)
>> >>        at java.lang.Thread.run(Thread.java:595)
>> >> javax.jbi.messaging.MessagingException: illegal call to send /
>> sendSync
>> >>        at
>> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> >> MessageExchangeImpl.java:581)
>> >>        at
>> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>> >> DeliveryChannelImpl.java:384)
>> >>        at
>> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> >> DeliveryChannelImpl.java:444)
>> >>        at
>> >>
>> org.apache.servicemix.components.util.PojoSupport.done(PojoSupport.java
>> >> :193)
>> >>        at
>> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> >> SubscriberComponent.java:198)
>> >>        at
>> >>
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> >> DeliveryChannelImpl.java:621)
>> >>        at
>> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> >> AbstractFlow.java:174)
>> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
>> >> JMSFlow.java:1)
>> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>> >> JMSFlow.java:543)
>> >>        at
>> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> >> (ThreadPoolExecutor.java:665)
>> >>        at
>> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> >> (ThreadPoolExecutor.java:690)
>> >>        at java.lang.Thread.run(Thread.java:595)
>> >>
>> >> What do I do wrong?
>> >> Thanks in advance!
>> >>
>> >> Martina
>> >>
>> >>
>> >> gnodet wrote:
>> >> >
>> >> > Just before calling fail(exchange, e), could you display the stack
>> >> trace
>> >> > of
>> >> > the exception ?
>> >> >    e.printStackTrace()
>> >> > and send this error ?
>> >> > This is the real error, but it seems to be hidden by fail() throwing
>> >> > another
>> >> > excepiton.
>> >> >
>> >> > On Jan 7, 2008 12:32 PM, martymusk <ma...@email.it> wrote:
>> >> >
>> >> >>
>> >> >> Hy gnodet,
>> >> >> thank you for your felpfulness.
>> >> >> Thus, I've used InOnly exchange, but I've the same error.
>> >> >> I post you my class and the error.
>> >> >>
>> >> >> package org.apache.servicemix.wsn;
>> >> >>
>> >> >>
>> >> >> import java.io.StringWriter;
>> >> >>
>> >> >> import javax.jbi.JBIException;
>> >> >> import javax.jbi.messaging.ExchangeStatus;
>> >> >> import javax.jbi.messaging.MessageExchange;
>> >> >> import javax.jbi.messaging.MessagingException;
>> >> >> import javax.jbi.messaging.NormalizedMessage;
>> >> >> import javax.xml.bind.JAXBContext;
>> >> >> import javax.xml.transform.Source;
>> >> >> import javax.xml.transform.TransformerException;
>> >> >>
>> >> >> import org.apache.commons.logging.Log;
>> >> >> import org.apache.commons.logging.LogFactory;
>> >> >> import org.apache.servicemix.MessageExchangeListener;
>> >> >> import org.apache.servicemix.components.util.ComponentSupport;
>> >> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
>> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
>> >> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
>> >> >> import org.apache.servicemix.wsn.client.NotificationBroker;
>> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
>> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
>> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
>> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
>> >> >> import org.w3c.dom.Element;
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>  public class SubscriberComponent extends ComponentSupport
>> implements
>> >> >> MessageExchangeListener {
>> >> >>
>> >> >>            private static final Log log =
>> >> >> LogFactory.getLog(SubscriberComponent.class);
>> >> >>
>> >> >>            private NotificationBroker wsnBroker;
>> >> >>            private String receiveTopic;
>> >> >>            private boolean demand;
>> >> >>            private String subscriptionEndpoint = "subscription";
>> >> >>            private Subscribe subscription;
>> >> >>
>> >> >>            /**
>> >> >>             * @return Returns the demand.
>> >> >>             */
>> >> >>            public boolean getDemand() {
>> >> >>                return demand;
>> >> >>            }
>> >> >>
>> >> >>            /**
>> >> >>             * @param demand The demand to set.
>> >> >>             */
>> >> >>            public void setDemand(boolean demand) {
>> >> >>                this.demand = demand;
>> >> >>            }
>> >> >>
>> >> >>            /**
>> >> >>             * @return Returns the topic.
>> >> >>             */
>> >> >>            public String getTopic() {
>> >> >>                return receiveTopic;
>> >> >>            }
>> >> >>
>> >> >>            /**
>> >> >>             * @param topic The topic to set.
>> >> >>             */
>> >> >>            public void setTopic(String receiveTopic) {
>> >> >>                this.receiveTopic = receiveTopic;
>> >> >>            }
>> >> >>
>> >> >>            /**
>> >> >>             * @return Returns the subscription.
>> >> >>             */
>> >> >>            public Subscribe getSubscription() {
>> >> >>                return subscription;
>> >> >>            }
>> >> >>
>> >> >>            /* (non-Javadoc)
>> >> >>             * @see
>> >> >> org.apache.servicemix.jbi.management.BaseLifeCycle#init
>> >> >> ()
>> >> >>             */
>> >> >>            public void init() throws JBIException {
>> >> >>                super.init();
>> >> >>                getContext().activateEndpoint(getService(),
>> >> >> subscriptionEndpoint);
>> >> >>            }
>> >> >>
>> >> >>            /* (non-Javadoc)
>> >> >>             * @see javax.jbi.management.LifeCycleMBean#start()
>> >> >>             */
>> >> >>            public void start() throws JBIException {
>> >> >>                new Thread() {
>> >> >>                    public void run() {
>> >> >>                        try {
>> >> >>                            wsnBroker = new
>> >> >> NotificationBroker(getContext());
>> >> >>                            String wsaAddress =
>> >> >> getService().getNamespaceURI() +
>> >> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>> >> >>
>> >> >>
>> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
>> >> >>                                                       
>> receiveTopic,
>> >> >>                                                        demand);
>> >> >>                        } catch (Exception e) {
>> >> >>                            log.error("Could not create wsn client",
>> >> e);
>> >> >>                        }
>> >> >>                    }
>> >> >>                }.start();
>> >> >>            }
>> >> >>
>> >> >>
>> >> >>            private SourceTransformer sourceTransformer = new
>> >> >> SourceTransformer();
>> >> >>
>> >> >>            public SourceTransformer getSourceTransformer() {
>> >> >>                        return sourceTransformer;
>> >> >>                }
>> >> >>
>> >> >>                public void setSourceTransformer(SourceTransformer
>> >> >> sourceTransformer) {
>> >> >>                        this.sourceTransformer = sourceTransformer;
>> >> >>                }
>> >> >>
>> >> >>            /* (non-Javadoc)
>> >> >>             * @see javax.jbi.management.LifeCycleMBean#shutDown()
>> >> >>             */
>> >> >>            public void shutDown() throws JBIException {
>> >> >>                super.shutDown();
>> >> >>            }
>> >> >>
>> >> >>            /* (non-Javadoc)
>> >> >>             * @see
>> >> >> org.apache.servicemix.MessageExchangeListener#onMessageExchange(
>> >> >> javax.jbi.messaging.MessageExchange)
>> >> >>             */
>> >> >>            public void onMessageExchange(MessageExchange exchange)
>> >> throws
>> >> >> MessagingException {
>> >> >>
>> >> >>                NormalizedMessage message = exchange.getMessage
>> ("in");
>> >> >>                        if (message == null) {
>> >> >>                                log.warn("Received null message from
>> >> >> exchange: " + exchange);
>> >> >>                        } else {
>> >> >>                                log.info("Exchange: " + exchange + "
>> >> >> received IN message: "
>> >> >>                                                + message);
>> >> >>                                try {
>> >> >>                                        log.info("Body is: "
>> >> >>                                                        +
>> >> >> sourceTransformer.toString(message.getContent()));
>> >> >>                                } catch (TransformerException e) {
>> >> >>                                        log.error("Failed to turn
>> >> message
>> >> >> body into text: " + e, e);
>> >> >>                                }
>> >> >>                        }
>> >> >>                        done(exchange);
>> >> >>                        log.info("MESSAGGIO RICEVUTO");
>> >> >>
>> >> >>                  log.info("COPIO IL PACCHETTO");
>> >> >>
>> >> >>                        MessageExchange scambio =
>> >> >> (MessageExchange)exchange;
>> >> >>                        log.info("IL PACCHETTO COPIATO E': "
>> +scambio);
>> >> >>
>> >> >>
>> >> >>                if (exchange.getStatus() != ExchangeStatus.DONE) {
>> >> >>                        log.info("RITORNA PERCHE' LO STATO E': "
>> >> >> +exchange.getStatus());
>> >> >>                    return;
>> >> >>                }
>> >> >>                // This is a notification from the WSN broker
>> >> >>                if
>> >> >>
>> >>
>> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
>> >> {
>> >> >>                    try {
>> >> >>                        JAXBContext jaxbContext =
>> >> >> JAXBContext.newInstance(Subscribe.class);
>> >> >>                        Source src = exchange.getMessage
>> >> >> ("in").getContent();
>> >> >>                        Object input =
>> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
>> >> >>                        if (input instanceof Subscribe) {
>> >> >>                            subscription = (Subscribe) input;
>> >> >>                            SubscribeResponse response = new
>> >> >> SubscribeResponse();
>> >> >>                            String wsaAddress =
>> >> >> getService().getNamespaceURI() +
>> >> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>> >> >>
>> >> >> response.setSubscriptionReference(AbstractWSAClient.createWSA
>> >> >> (wsaAddress));
>> >> >>                            StringWriter writer = new
>> StringWriter();
>> >> >>                            jaxbContext.createMarshaller
>> >> >> ().marshal(response,
>> >> >> writer);
>> >> >>                            NormalizedMessage out =
>> >> exchange.createMessage
>> >> >> ();
>> >> >>                            out.setContent(new
>> >> >> StringSource(writer.toString
>> >> >> ()));
>> >> >>                            exchange.setMessage(out, "out");
>> >> >>                            send(exchange);
>> >> >>
>> >> >>                        } else if (input instanceof Unsubscribe) {
>> >> >>                            subscription = null;
>> >> >>                            UnsubscribeResponse response = new
>> >> >> UnsubscribeResponse();
>> >> >>                            StringWriter writer = new
>> StringWriter();
>> >> >>                            jaxbContext.createMarshaller
>> >> >> ().marshal(response,
>> >> >> writer);
>> >> >>                            NormalizedMessage out =
>> >> exchange.createMessage
>> >> >> ();
>> >> >>                            out.setContent(new
>> >> >> StringSource(writer.toString
>> >> >> ()));
>> >> >>                            exchange.setMessage(out, "out");
>> >> >>                            send(exchange);
>> >> >>
>> >> >>
>> >> >>                        } else {
>> >> >>                            throw new Exception("Unkown request");
>> >> >>                        }
>> >> >>                    } catch (Exception e) {
>> >> >>                        fail(exchange, e);
>> >> >>                    }
>> >> >>                // This is a notification to publish
>> >> >>                }
>> >> >>
>> >> >>                  else {
>> >> >>                    try {
>> >> >>                        if (!demand || subscription != null) {
>> >> >>                            Element elem = new
>> >> >> SourceTransformer().toDOMElement(exchange.getMessage("in"));
>> >> >>                            wsnBroker.notify(receiveTopic, elem);
>> >> >>                            done(exchange);
>> >> >>                        } else {
>> >> >>                            log.info("Ingore notification as the
>> >> publisher
>> >> >> is no
>> >> >> subscribers");
>> >> >>                        }
>> >> >>                    } catch (Exception e) {
>> >> >>                        fail(exchange, e);
>> >> >>                        }
>> >> >>                }
>> >> >>            }
>> >> >>
>> >> >>  }
>> >> >>
>> >> >>  ......
>> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> >> messageId
>> >> >> =
>> >> >> ID:martina-39597-1199704995676-3:0:1:1:5, originalDestination =
>> null,
>> >> >> originalTransactionId = null, producerId =
>> >> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
>> >> >> queue://org.apache.servicemix.jms.{
>> >> >>
>> >>
>> http://servicemix.apache.org/demo}trace:endpoint<http://servicemix.apache.org/demo%7Dtrace:endpoint>
>> <http://servicemix.apache.org/demo%7Dtrace:endpoint>
>> >> <http://servicemix.apache.org/demo%7Dtrace:endpoint>
>> >> >> ,
>> >> >> transactionId = null, expiration = 0, timestamp = 1199705011173,
>> >> arrival
>> >> >> =
>> >> >> 0, correlationId = null, replyTo = null, persistent = true, type =
>> >> null,
>> >> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
>> >> null,
>> >> >> compressed = false, userID = null, content =
>> >> >> org.apache.activemq.util.ByteSequence@10a69f0, marshalledProperties
>> =
>> >> >> null,
>> >> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
>> >> null,
>> >> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
>> >> >> INFO  - SubscriberComponent            - Exchange: InOnly[
>> >> >>  id: ID:192.168.0.172-11753fdefba-2:0
>> >> >>  status: Active
>> >> >>  role: provider
>> >> >>  endpoint: endpoint
>> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >> >>
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> >> >> Example
>> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> >> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>> >> >>
>> >> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> >> ] received IN message:
>> >> >>
>> >> >>
>> >>
>> org.apache.servicemix.jbi.messaging.NormalizedMessageImpl@b125bd{properties
>> >> >> :
>> >> >> {}}
>> >> >> INFO  - SubscriberComponent            - Body is: <?xml
>> version="1.0
>> "
>> >> >> encoding="UTF-8"?><ns2:Notify xmlns:ns2="
>> >> >> http://docs.oasis-open.org/wsn/b-2"
>> >> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >> >>
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> >> >> Example
>> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> >> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>> >> >>
>> >> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
>> >> status
>> >> =
>> >> >> getStatus()
>> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA
>> LO
>> >> >> STATO
>> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> me.handleSend(sync)
>> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> container.sendExchange(mirror);
>> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> >> messageId
>> >> >> =
>> >> >> ID:martina-39597-1199704995676-3:0:1:1:6, originalDestination =
>> null,
>> >> >> originalTransactionId = null, producerId =
>> >> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
>> >> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
>> >> expiration
>> >> >> =
>> >> >> 0, timestamp = 1199705011183, arrival = 0, correlationId = null,
>> >> replyTo
>> >> >> =
>> >> >> null, persistent = true, type = null, priority = 4, groupID = null,
>> >> >> groupSequence = 0, targetConsumerId = null, compressed = false,
>> userID
>> >> =
>> >> >> null, content = org.apache.activemq.util.ByteSequence@c70f32,
>> >> >> marshalledProperties = null, dataStructure = null,
>> redeliveryCounter
>> =
>> >> 0,
>> >> >> size = 0, properties = null, readOnlyProperties = true,
>> readOnlyBody
>> =
>> >> >> true,
>> >> >> droppable = false}
>> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> container.sendExchange(mirror);
>> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> >> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> >> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
>> >> InOnly[
>> >> >>  id: ID:192.168.0.172-11753fdefba-2:0
>> >> >>  status: Done
>> >> >>  role: provider
>> >> >>  endpoint: endpoint
>> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >> >>
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> >> >> Example
>> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> >> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>> >> >>
>> >> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> >> ]
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
>> >> status
>> >> =
>> >> >> getStatus()
>> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA
>> LO
>> >> >> STATO
>> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> me.handleSend(sync)
>> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> DEBUG - WSNSpringComponent             - Received exchange: status:
>> >> Done,
>> >> >> role: consumer
>> >> >> DEBUG - WSNSpringComponent             - Retrieved correlation id:
>> >> null
>> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> >> messageId
>> >> >> =
>> >> >> ID:martina-39597-1199704995676-3:0:1:1:7, originalDestination =
>> null,
>> >> >> originalTransactionId = null, producerId =
>> >> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
>> >> >> queue://org.apache.servicemix.jms.{
>> >> >>
>> >>
>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> >> ,
>> >> >> transactionId = null, expiration = 0, timestamp = 1199705011188,
>> >> arrival
>> >> >> =
>> >> >> 0, correlationId = null, replyTo = null, persistent = true, type =
>> >> null,
>> >> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
>> >> null,
>> >> >> compressed = false, userID = null, content =
>> >> >> org.apache.activemq.util.ByteSequence@1c8f59c, marshalledProperties
>> =
>> >> >> null,
>> >> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
>> >> null,
>> >> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
>> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> container.sendExchange(mirror);
>> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> ERROR - JMSFlow                        - Caught an exception
>> routing
>> >> >> ExchangePacket:
>> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
>> >> sendSync
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> >> >> MessageExchangeImpl.java:581)
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>> >> >> DeliveryChannelImpl.java:384)
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> >> >> DeliveryChannelImpl.java:444)
>> >> >>        at
>> >> >>
>> >>
>> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
>> >> >> :249)
>> >> >>        at
>> >> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> >> >> SubscriberComponent.java:203)
>> >> >>        at
>> >> >>
>> >>
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> >> >> DeliveryChannelImpl.java:621)
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> >> >> AbstractFlow.java:174)
>> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
>> >> >> JMSFlow.java:1)
>> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>> >> >> JMSFlow.java:543)
>> >> >>        at
>> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> >> >> (ThreadPoolExecutor.java:665)
>> >> >>        at
>> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> >> >> (ThreadPoolExecutor.java:690)
>> >> >>        at java.lang.Thread.run(Thread.java:595)
>> >> >>
>> >> >> Can you help me again?
>> >> >> Thanks in advance!
>> >> >>
>> >> >> Martina
>> >> >>
>> >> >>
>> >> >>
>> >> >> gnodet wrote:
>> >> >> >
>> >> >> > You need to use an InOnly or RobustInOnly exchange, not an InOut
>> >> >> exchange,
>> >> >> > as notifications do not have any out messages.
>> >> >> >
>> >> >> > On Jan 4, 2008 5:16 PM, martymusk <ma...@email.it> wrote:
>> >> >> >
>> >> >> >>
>> >> >> >> Thus , I've created a new class "SubscriberComponent" that is a
>> >> copy
>> >> >> of
>> >> >> >> PublisherComponent. Trhough it instance2 receive exchange and
>> try
>> >> to
>> >> >> send
>> >> >> >> scambio (copy of exchange). When I run example the following
>> error
>> >> >> >> occurs...
>> >> >> >>
>> >> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> >> >> messageId
>> >> >> >> =
>> >> >> >> ID:martina-38529-1199462112612-3:0:1:1:6, originalDestination =
>> >> null,
>> >> >> >> originalTransactionId = null, producerId =
>> >> >> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
>> >> >> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
>> >> >> expiration
>> >> >> >> =
>> >> >> >> 0, timestamp = 1199462153935, arrival = 0, correlationId = null,
>> >> >> replyTo
>> >> >> >> =
>> >> >> >> null, persistent = true, type = null, priority = 4, groupID =
>> null,
>> >> >> >> groupSequence = 0, targetConsumerId = null, compressed = false,
>> >> userID
>> >> >> =
>> >> >> >> null, content = org.apache.activemq.util.ByteSequence@b2175,
>> >> >> >> marshalledProperties = null, dataStructure = null,
>> >> redeliveryCounter
>> >> =
>> >> >> 0,
>> >> >> >> size = 0, properties = null, readOnlyProperties = true,
>> >> readOnlyBody
>> >> =
>> >> >> >> true,
>> >> >> >> droppable = false}
>> >> >> >> DEBUG - WSNSpringComponent             - Received exchange:
>> status:
>> >> >> >> Active,
>> >> >> >> role: consumer
>> >> >> >> DEBUG - WSNSpringComponent             - Retrieved correlation
>> id:
>> >> >> null
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> >> container.sendExchange(mirror);
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> >> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> >> >> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> >> >> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO
>> E':
>> >> >> InOut[
>> >> >> >>  id: ID:192.168.0.172-1174583cdf9-2:0
>> >> >> >>  status: Active
>> >> >> >>  role: provider
>> >> >> >>  endpoint: endpoint
>> >> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> >> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >> >> >>
>> >> >>
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing
>> "><name>My
>> >> >> >> Example
>> >> >> >>
>> Job</name><group>ServiceMix</group><fullname>ServiceMix.MyExample
>> >> >> >> Job</fullname><description/><fireTime>Fri Jan 04 16:55:53 CET
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> >> >> ]
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
>> LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
>> >> >> status
>> >> >> =
>> >> >> >> getStatus()
>> >> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E
>> CAMBIA
>> >> LO
>> >> >> >> STATO
>> >> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> me.handleSend(sync)
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> >> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> >> >> messageId
>> >> >> >> =
>> >> >> >> ID:martina-38529-1199462112612-3:0:1:1:7, originalDestination =
>> >> null,
>> >> >> >> originalTransactionId = null, producerId =
>> >> >> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
>> >> >> >> queue://org.apache.servicemix.jms.{
>> >> >> >>
>> >> >>
>> >>
>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> >> >> ,
>> >> >> >> transactionId = null, expiration = 0, timestamp = 1199462153952,
>> >> >> arrival
>> >> >> >> =
>> >> >> >> 0, correlationId = null, replyTo = null, persistent = true, type
>> =
>> >> >> null,
>> >> >> >> priority = 4, groupID = null, groupSequence = 0,
>> targetConsumerId
>> =
>> >> >> null,
>> >> >> >> compressed = false, userID = null, content =
>> >> >> >> org.apache.activemq.util.ByteSequence@779b3e,
>> marshalledProperties
>> >> =
>> >> >> >> null,
>> >> >> >> dataStructure = null, redeliveryCounter = 0, size = 0,
>> properties
>> =
>> >> >> null,
>> >> >> >> readOnlyProperties = true, readOnlyBody = true, droppable =
>> false}
>> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> >> container.sendExchange(mirror);
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
>> LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I
>> LISTNERS
>> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> >> ERROR - JMSFlow                        - Caught an exception
>> >> routing
>> >> >> >> ExchangePacket:
>> >> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
>> >> >> sendSync
>> >> >> >>        at
>> >> >> >>
>> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> >> >> >> MessageExchangeImpl.java:581)
>> >> >> >>        at
>> >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>> >> >> >> DeliveryChannelImpl.java:384)
>> >> >> >>        at
>> >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> >> >> >> DeliveryChannelImpl.java:444)
>> >> >> >>        at
>> >> >> >>
>> >> >>
>> >>
>> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
>> >> >> >> :249)
>> >> >> >>        at
>> >> >> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> >> >> >> SubscriberComponent.java:203)
>> >> >> >>        at
>> >> >> >>
>> >> >>
>> >>
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> >> >> >> DeliveryChannelImpl.java:621)
>> >> >> >>        at
>> >> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> >> >> >> AbstractFlow.java:174)
>> >> >> >>        at
>> org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3
>> (
>> >> >> >> JMSFlow.java:1)
>> >> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>> >> >> >> JMSFlow.java:543)
>> >> >> >>        at
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> >> >> >> (ThreadPoolExecutor.java:665)
>> >> >> >>        at
>> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> >> >> >> (ThreadPoolExecutor.java:690)
>> >> >> >>        at java.lang.Thread.run(Thread.java:595)
>> >> >> >>
>> >> >> >> I do wrong again?
>> >> >> >>
>> >> >> >> Thank you!!!
>> >> >> >> Martina
>> >> >> >>
>> >> >> >>
>> >> >> >> gnodet wrote:
>> >> >> >> >
>> >> >> >> > You should have a look at the existing code:
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/spring/PublisherComponent.java?r=602828
>> >> >> >> >
>> >> >> >> > Note that the publisher component actually use the client api
>> >> (line
>> >> >> >> 172).
>> >> >> >> > For details on thow the client api works (which is how to send
>> a
>> >> JBI
>> >> >> >> > exchange to the WSN broker), see:
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >>
>> >>
>> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/client/NotificationBroker.java?r=602828#l89
>> >> >> >> >
>> >> >> >> > I would advise you to start from the publisher component, copy
>> it
>> >> >> and
>> >> >> >> use
>> >> >> >> > it
>> >> >> >> > instead of your TraceComponent.
>> >> >> >> > Each time it receives a JBI exchange, it will publish it
>> through
>> >> the
>> >> >> >> > WSNotification broker.
>> >> >> >> >
>> >> >> >> > Also look at the various resources on the web site that may
>> help
>> >> >> you:
>> >> >> >> >   http://servicemix.apache.org/servicemix-wsn2005.html
>> >> >> >> >   http://servicemix.apache.org/example-scenario.html
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > On Jan 4, 2008 2:58 PM, martymusk <ma...@email.it> wrote:
>> >> >> >> >
>> >> >> >> >>
>> >> >> >> >> Hy gnodet and thank you very much for your helpfulness,
>> >> >> >> >> but I don't understand exactly what I must to do.
>> >> >> >> >>
>> >> >> >> >> How can I send JBI exchange to the WSN broker directly?
>> >> >> >> >> How can I use WSN client api.
>> >> >> >> >>
>> >> >> >> >> I'm working for a thesis at University of Naples.
>> >> >> >> >> My purpose is to study WSN performance.
>> >> >> >> >> I've found your WSN implementation very useful for me, but to
>> >> study
>> >> >> >> >> performance, I need exchange was send back.
>> >> >> >> >> It is more than a mounth I'm triyng to do this.
>> >> >> >> >>
>> >> >> >> >> I would be very grateful if you can help me. Otherwise, there
>> >> are
>> >> >> no
>> >> >> >> >> problems, I'll keep on study over and over again, hoping I be
>> >> able
>> >> >> to
>> >> >> >> >> achieve my purpose.
>> >> >> >> >>
>> >> >> >> >> Thank you very much.
>> >> >> >> >> Martina
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> gnodet wrote:
>> >> >> >> >> >
>> >> >> >> >> > I thought I pointed you to the right direction.
>> >> >> >> >> > Do not use the PublisherComponent that way: either use it
>> as
>> >> it
>> >> >> is
>> >> >> >> >> > intended
>> >> >> >> >> > (deploy it as a component onto the lightweight container)
>> or
>> >> use
>> >> >> the
>> >> >> >> >> WSN
>> >> >> >> >> > client api:
>> >> >> >> >> >    wsn.notify(topic, msg)
>> >> >> >> >> >
>> >> >> >> >> > I'm not sure what you are trying to achieve with your
>> >> >> >> TraceComponent.
>> >> >> >> >>  It
>> >> >> >> >> > sounds like you want to reimplement the PublisherComponent.
>> >> If
>> >> >> so,
>> >> >> >> you
>> >> >> >> >> > should have a look at how it is implemented and patch it.
>> >> >> >> >> >
>> >> >> >> >> > Also note that both PublisherComponent and the WSN client
>> api
>> >> are
>> >> >> >> just
>> >> >> >> >> > sugar, you can send a JBI exchange to the WSN broker
>> directly
>> >> if
>> >> >> you
>> >> >> >> >> want.
>> >> >> >> >> >
>> >> >> >> >> > On Jan 4, 2008 2:13 PM, martymusk <ma...@email.it>
>> wrote:
>> >> >> >> >> >
>> >> >> >> >> >>
>> >> >> >> >> >> My problem is always the same!
>> >> >> >> >> >> In wsn-example, after Consumer received an exchange, I'd
>> like
>> >> it
>> >> >> >> send
>> >> >> >> >> >> copy
>> >> >> >> >> >> of it. But it doesn't happen. :-(
>> >> >> >> >> >> I've modified TraceComponent class in the following way,
>> but
>> >> it
>> >> >> >> >> doesn't
>> >> >> >> >> >> work
>> >> >> >> >> >> fine:
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >> package org.apache.servicemix.wsn;
>> >> >> >> >> >>
>> >> >> >> >> >> import java.io.StringWriter;
>> >> >> >> >> >>
>> >> >> >> >> >> import javax.jbi.JBIException;
>> >> >> >> >> >> import javax.jbi.messaging.ExchangeStatus;
>> >> >> >> >> >> import javax.jbi.messaging.MessageExchange;
>> >> >> >> >> >> import javax.jbi.messaging.MessagingException;
>> >> >> >> >> >> import javax.jbi.messaging.NormalizedMessage;
>> >> >> >> >> >> import javax.xml.bind.JAXBContext;
>> >> >> >> >> >> import javax.xml.transform.Source;
>> >> >> >> >> >> import javax.xml.transform.TransformerException;
>> >> >> >> >> >> //import javax.jbi.messaging.InOut;
>> >> >> >> >> >>
>> >> >> >> >> >> import
>> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl
>> >> ;
>> >> >> >> >> >> import org.apache.servicemix.jbi.messaging.InOutImpl;
>> >> >> >> >> >> import org.apache.commons.logging.Log;
>> >> >> >> >> >> import org.apache.commons.logging.LogFactory;
>> >> >> >> >> >> import org.apache.servicemix.MessageExchangeListener;
>> >> >> >> >> >> import
>> >> org.apache.servicemix.components.util.ComponentSupport;
>> >> >> >> >> >> import
>> org.apache.servicemix.wsn.spring.PublisherComponent;
>> >> >> >> >> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
>> >> >> >> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
>> >> >> >> >> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
>> >> >> >> >> >> import
>> org.apache.servicemix.wsn.client.NotificationBroker;
>> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
>> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
>> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
>> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
>> >> >> >> >> >> import org.w3c.dom.Element;
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >> public class TraceComponent extends ComponentSupport
>> >> implements
>> >> >> >> >> >>                MessageExchangeListener {
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>        private Log log =
>> >> >> LogFactory.getLog(TraceComponent.class);
>> >> >> >> >> >>
>> >> >> >> >> >>        private SourceTransformer sourceTransformer = new
>> >> >> >> >> >> SourceTransformer();
>> >> >> >> >> >>
>> >> >> >> >> >>        public Log getLog() {
>> >> >> >> >> >>                return log;
>> >> >> >> >> >>        }
>> >> >> >> >> >>
>> >> >> >> >> >>        public void setLog(Log log) {
>> >> >> >> >> >>                this.log = log;
>> >> >> >> >> >>        }
>> >> >> >> >> >>
>> >> >> >> >> >>        public SourceTransformer getSourceTransformer() {
>> >> >> >> >> >>                return sourceTransformer;
>> >> >> >> >> >>        }
>> >> >> >> >> >>
>> >> >> >> >> >>        public void setSourceTransformer(SourceTransformer
>> >> >> >> >> >> sourceTransformer) {
>> >> >> >> >> >>                this.sourceTransformer = sourceTransformer;
>> >> >> >> >> >>        }
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>        //AGGIUNGO CODICE
>> >> >> >> >> >>
>> >> >> >> >> >>        PublisherComponent publisher = new
>> >> PublisherComponent();
>> >> >> >> >> >>          private String subscriptionEndpoint =
>> >> "subscription";
>> >> >> >> >> >>          private NotificationBroker wsnBroker;
>> >> >> >> >> >>          private String topic;
>> >> >> >> >> >>          private String msg;
>> >> >> >> >> >>          private boolean demand;
>> >> >> >> >> >>          private Subscribe subscription;
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>          public String getTopic() {
>> >> >> >> >> >>                return topic;
>> >> >> >> >> >>            }
>> >> >> >> >> >>
>> >> >> >> >> >>            /**
>> >> >> >> >> >>             * @param topic The topic to set.
>> >> >> >> >> >>             */
>> >> >> >> >> >>            public void setTopic(String topic) {
>> >> >> >> >> >>               this.topic = topic;
>> >> >> >> >> >>            }
>> >> >> >> >> >>
>> >> >> >> >> >>         public void init() throws JBIException {
>> >> >> >> >> >>                super.init();
>> >> >> >> >> >>                getContext().activateEndpoint(getService(),
>> >> >> >> >> >> subscriptionEndpoint);
>> >> >> >> >> >>                 log.info("METODO INIT");
>> >> >> >> >> >>                // publisher.init();
>> >> >> >> >> >>
>> >> >> >> >> >>                 publisher.setTopic(topic);
>> >> >> >> >> >>            }
>> >> >> >> >> >>
>> >> >> >> >> >>            /* (non-Javadoc)
>> >> >> >> >> >>             * @see
>> >> javax.jbi.management.LifeCycleMBean#start()
>> >> >> >> >> >>             */
>> >> >> >> >> >>            public void start() throws JBIException {
>> >> >> >> >> >>
>> >> >> >> >> >>                log.info("METODO START");
>> >> >> >> >> >>                //publisher.start();
>> >> >> >> >> >>                new Thread() {
>> >> >> >> >> >>                  public void run() {
>> >> >> >> >> >>                       try {
>> >> >> >> >> >>                           wsnBroker = new
>> >> >> >> >> >> NotificationBroker(getContext());
>> >> >> >> >> >>
>> >> >> >> >> >>                           String wsaAddress =
>> >> >> >> >> >> getService().getNamespaceURI() + "/"
>> >> >> >> >> >> + getService().getLocalPart() + "/" +
>> subscriptionEndpoint;
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >>
>> >> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
>> >> >> >> >> >>
>> topic,
>> >> >> >> >> >>
>> >>  demand);
>> >> >> >> >> >>                        } catch (Exception e) {
>> >> >> >> >> >>                            log.error("Could not create wsn
>> >> >> client",
>> >> >> >> >> e);
>> >> >> >> >> >>                        }
>> >> >> >> >> >>                    }
>> >> >> >> >> >>                }.start();
>> >> >> >> >> >>            }
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>            public void shutDown() throws JBIException {
>> >> >> >> >> >>                log.info("METODO SHUTDOWN");
>> >> >> >> >> >>            //  publisher.shutDown();
>> >> >> >> >> >>               super.shutDown();
>> >> >> >> >> >>            }
>> >> >> >> >> >>
>> >> >> >> >> >>            //FINE CODICE AGGIUNTO
>> >> >> >> >> >>
>> >> >> >> >> >>        public void onMessageExchange(MessageExchange
>> >> exchange)
>> >> >> >> >> >>                        throws MessagingException {
>> >> >> >> >> >>                // lets dump the incoming message
>> >> >> >> >> >>                NormalizedMessage message =
>> >> exchange.getMessage
>> >> >> >> ("in");
>> >> >> >> >> >>                if (message == null) {
>> >> >> >> >> >>                        log.warn("Received null message
>> from
>> >> >> >> exchange:
>> >> >> >> >> "
>> >> >> >> >> +
>> >> >> >> >> >> exchange);
>> >> >> >> >> >>                } else {
>> >> >> >> >> >>                        log.info("Exchange: " + exchange +
>> "
>> >> >> >> received
>> >> >> >> >> IN
>> >> >> >> >> >> message: "
>> >> >> >> >> >>                                        + message);
>> >> >> >> >> >>                        try {
>> >> >> >> >> >>                                log.info("Body is: "
>> >> >> >> >> >>                                                +
>> >> >> >> >> >> sourceTransformer.toString(message.getContent()));
>> >> >> >> >> >>                        } catch (TransformerException e) {
>> >> >> >> >> >>                                log.error("Failed to turn
>> >> message
>> >> >> >> body
>> >> >> >> >> >> into
>> >> >> >> >> >> text: " + e, e);
>> >> >> >> >> >>                        }
>> >> >> >> >> >>                }
>> >> >> >> >> >>                done(exchange);
>> >> >> >> >> >>                log.info("MESSAGGIO RICEVUTO");
>> >> >> >> >> >>
>> >> >> >> >> >>                log.info("COPIO IL PACCHETTO");
>> >> >> >> >> >>
>> >> >> >> >> >>                MessageExchange scambio =
>> >> >> (MessageExchange)exchange;
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>                log.info("INVIO");
>> >> >> >> >> >>
>> >> >> >> >> >>          try{
>> >> >> >> >> >>
>> >> >> >> >> >>                log.info("FASE INVIO");
>> >> >> >> >> >>                //publisher.onMessageExchange(scambio);
>> >> >> >> >> >>
>> >> >> >> >> >>                //AGGIUNGO onMessageExchange
>> >> >> >> >> >>
>> >> >> >> >> >>                if (exchange.getStatus() !=
>> >> >> ExchangeStatus.ACTIVE)
>> >> >> {
>> >> >> >> >> >>                    return;
>> >> >> >> >> >>                }
>> >> >> >> >> >>                // This is a notification from the WSN
>> broker
>> >> >> >> >> >>                if
>> >> >> >> >> >>
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
>> >> >> >> >> {
>> >> >> >> >> >>                    try {
>> >> >> >> >> >>                        JAXBContext jaxbContext =
>> >> >> >> >> >> JAXBContext.newInstance(Subscribe.class);
>> >> >> >> >> >>                        Source src = exchange.getMessage
>> >> >> >> >> >> ("in").getContent();
>> >> >> >> >> >>                        Object input =
>> >> >> >> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
>> >> >> >> >> >>                        if (input instanceof Subscribe) {
>> >> >> >> >> >>                            subscription = (Subscribe)
>> input;
>> >> >> >> >> >>                            SubscribeResponse response =
>> new
>> >> >> >> >> >> SubscribeResponse();
>> >> >> >> >> >>                            String wsaAddress =
>> >> >> >> >> >> getService().getNamespaceURI() +
>> >> >> >> >> >> "/" + getService().getLocalPart() + "/" +
>> >> subscriptionEndpoint;
>> >> >> >> >> >>
>> >> >> >> >> >> response.setSubscriptionReference(
>> AbstractWSAClient.createWSA
>> >> >> >> >> >> (wsaAddress));
>> >> >> >> >> >>                            StringWriter writer = new
>> >> >> >> StringWriter();
>> >> >> >> >> >>                            jaxbContext.createMarshaller
>> >> >> >> >> >> ().marshal(response,
>> >> >> >> >> >> writer);
>> >> >> >> >> >>                            NormalizedMessage out =
>> >> >> >> >> exchange.createMessage
>> >> >> >> >> >> ();
>> >> >> >> >> >>                            out.setContent(new
>> >> >> >> >> >> StringSource(writer.toString
>> >> >> >> >> >> ()));
>> >> >> >> >> >>                            exchange.setMessage(out,
>> "out");
>> >> >> >> >> >>                            send(exchange);
>> >> >> >> >> >>
>> >> >> >> >> >>                        } else if (input instanceof
>> >> Unsubscribe)
>> >> >> {
>> >> >> >> >> >>                            subscription = null;
>> >> >> >> >> >>                            UnsubscribeResponse response =
>> new
>> >> >> >> >> >> UnsubscribeResponse();
>> >> >> >> >> >>                            StringWriter writer = new
>> >> >> >> StringWriter();
>> >> >> >> >> >>                            jaxbContext.createMarshaller
>> >> >> >> >> >> ().marshal(response,
>> >> >> >> >> >> writer);
>> >> >> >> >> >>                            NormalizedMessage out =
>> >> >> >> >> exchange.createMessage
>> >> >> >> >> >> ();
>> >> >> >> >> >>                            out.setContent(new
>> >> >> >> >> >> StringSource(writer.toString
>> >> >> >> >> >> ()));
>> >> >> >> >> >>                            exchange.setMessage(out,
>> "out");
>> >> >> >> >> >>                            send(exchange);
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>                        } else {
>> >> >> >> >> >>                            throw new Exception("Unkown
>> >> >> request");
>> >> >> >> >> >>                        }
>> >> >> >> >> >>                    } catch (Exception e) {
>> >> >> >> >> >>                        fail(exchange, e);
>> >> >> >> >> >>                    }
>> >> >> >> >> >>                // This is a notification to publish
>> >> >> >> >> >>                }
>> >> >> >> >> >>
>> >> >> >> >> >>                  else {
>> >> >> >> >> >>                    try {
>> >> >> >> >> >>
>> >> >> >> >> >>                    log.info("SALTA");
>> >> >> >> >> >>                        if (!demand || subscription !=
>> null)
>> {
>> >> >> >> >> >>                                log.info("ENTRO NELL'IF");
>> >> >> >> >> >>                           // Element elem = new
>> >> >> >> >> >> SourceTransformer().toDOMElement(exchange.getMessage
>> ("in"));
>> >> >> >> >> >>                            log.info("PRIMA DI WSNBROKER");
>> >> >> >> >> >>                            wsnBroker.notify(topic, msg);
>> >> >> >> >> >>                            log.info("PRIMA DI DONE");
>> >> >> >> >> >>
>> >>  getDeliveryChannel().send(exchange);
>> >> >> >> >> >>                            log.info("DOPO DI DONE");
>> >> >> >> >> >>                        } else {
>> >> >> >> >> >>                            log.info("Ingore notification
>> as
>> >> the
>> >> >> >> >> publisher
>> >> >> >> >> >> is no
>> >> >> >> >> >> subscribers");
>> >> >> >> >> >>                        }
>> >> >> >> >> >>                    } catch (Exception e) {
>> >> >> >> >> >>                        fail(exchange, e);
>> >> >> >> >> >>                        }
>> >> >> >> >> >>
>> >> >> >> >> >>                log.debug("IL PACCHETTO INVIATO E': " +
>> >> scambio);
>> >> >> >> >> >>
>> >> >> >> >> >>                  }
>> >> >> >> >> >>                //FINE onMessageExchange
>> >> >> >> >> >>
>> >> >> >> >> >>           } catch(JBIException e){
>> >> >> >> >> >>                  log.error("ECCEZIONE GENERATA!");
>> >> >> >> >> >>          }
>> >> >> >> >> >>
>> >> >> >> >> >>      log.info("INVIATO");
>> >> >> >> >> >> }
>> >> >> >> >> >> }
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >> Help me if you can.
>> >> >> >> >> >> Thank you very much for your helpfulness...
>> >> >> >> >> >>
>> >> >> >> >> >> Martina
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >> gnodet wrote:
>> >> >> >> >> >> >
>> >> >> >> >> >> > You should not have to deal nor see the internal state
>> of
>> >> the
>> >> >> >> >> exchange.
>> >> >> >> >> >> > If guess you have an exception when trying to send an
>> >> >> exchange,
>> >> >> >> but
>> >> >> >> >> >> this
>> >> >> >> >> >> > means that there is a problem in your code.  You should
>> >> post
>> >> a
>> >> >> >> >> snippet
>> >> >> >> >> >> of
>> >> >> >> >> >> > your code that is failing so that we can help you.
>> >> >> >> >> >> >
>> >> >> >> >> >> > On Jan 4, 2008 12:22 PM, martymusk <ma...@email.it>
>> >> wrote:
>> >> >> >> >> >> >
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> Hy,
>> >> >> >> >> >> >> I've a question...
>> >> >> >> >> >> >> can I set anywhere Consumer to CAN_SEND?
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> I hope you can help me.
>> >> >> >> >> >> >> Thank you in advance.
>> >> >> >> >> >> >>
>> >> >> >> >> >> >> Martina
>> >> >> >> >> >> >> --
>> >> >> >> >> >> >> View this message in context:
>> >> >> >> >> >> >>
>> >> >> >> >>
>> >> >>
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
>> >> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> >> >> >> Nabble.com.
>> >> >> >> >> >> >>
>> >> >> >> >> >> >>
>> >> >> >> >> >> >
>> >> >> >> >> >> >
>> >> >> >> >> >> > --
>> >> >> >> >> >> > Cheers,
>> >> >> >> >> >> > Guillaume Nodet
>> >> >> >> >> >> > ------------------------
>> >> >> >> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >> >> >> >
>> >> >> >> >> >> >
>> >> >> >> >> >>
>> >> >> >> >> >> --
>> >> >> >> >> >> View this message in context:
>> >> >> >> >> >>
>> >> >> >>
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616107.html
>> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> >> >> Nabble.com.
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > --
>> >> >> >> >> > Cheers,
>> >> >> >> >> > Guillaume Nodet
>> >> >> >> >> > ------------------------
>> >> >> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >>
>> >> >> >> >> --
>> >> >> >> >> View this message in context:
>> >> >> >> >>
>> >> >>
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616748.html
>> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> >> Nabble.com.
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > --
>> >> >> >> > Cheers,
>> >> >> >> > Guillaume Nodet
>> >> >> >> > ------------------------
>> >> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >> --
>> >> >> >> View this message in context:
>> >> >> >>
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14619757.html
>> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> Nabble.com.
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > Cheers,
>> >> >> > Guillaume Nodet
>> >> >> > ------------------------
>> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14663812.html
>> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > Cheers,
>> >> > Guillaume Nodet
>> >> > ------------------------
>> >> > Blog: http://gnodet.blogspot.com/
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14664874.html
>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> > Cheers,
>> > Guillaume Nodet
>> > ------------------------
>> > Blog: http://gnodet.blogspot.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14665988.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14716016.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Consumer Can Send

Posted by Guillaume Nodet <gn...@gmail.com>.
You need to understand how exchanges are sent between components.
For a simple InOnly exchange, it will be the following:
   * consumer create the exchange and call send
   * provider receives the exchange (possibly in onMessageExchange)
   * provide set the done status and call send
   * consumer receives the exchange in a DONE status

In your case, the PublisherComponent acts both as a consumer and a provider,
because it receives an exchange and send a copy to the broker, so the
onMessageExchange will be called multiple times:
   * first when it receives the first exchange and acts as the provider (it
creates a new exchange and send it by using the WSNotification client api)
   * then when the exchange comes back with a DONE status

The log you pasted below is fine but is the second call to the method (you
can see the DONE status and even the content of the exchange that has been
previously sent).  Check earlier in your log and you will find what you
need.

On Jan 7, 2008 2:39 PM, martymusk <ma...@email.it> wrote:

>
> I've tried with original code, and it returns because status is DONE.
> I post output obtained with original code:
>
> DEBUG - WSNSpringComponent             - Received exchange: status: Done,
> role: consumer
> DEBUG - WSNSpringComponent             - Retrieved correlation id: null
> INFO  - DeliveryChannelImpl            - DOPO
> container.sendExchange(mirror);
> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E': InOnly[
>  id: ID:192.168.0.172-1175476963a-2:0
>  status: Done
>  role: provider
>  endpoint: endpoint
>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> xmlns="http://www.w3.org/2005/08/addressing"
> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My Example
> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> Job</fullname><description/><fireTime>Mon Jan 07 14:35:12 CET
>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> ]
> INFO  - SubscriberComponent            - RETURNS BECAUSE STATUS IS: Done
>
> So I've tried to modify ACTIVE with DONE, hoping it carry on, but it fails
> with error I've posted previously.
>
> I don't understand what I do wrong!
> It's more than a mounth I'm trying to return back exchange. :-(
>
> Thank you very much for help you give me!
>
> Martina
>
>
>
> gnodet wrote:
> >
> > Have you tried with the original code before modifying the class from
> > ServiceMix ?
> > The first lines of the SubscriberComponent#onMessageExchange are
> >
> >  if (exchange.getStatus() != ExchangeStatus.ACTIVE) {
> >      return;
> >  }
> >
> > This is because you have to ignore exchanges in an Error / Done status.
> > From the code you pasted, it seems you removed those lines and instead
> do
> > some copy work and call done() which will fail for exchanges that are
> not
> > active.
> >
> > You can add debugging statements if you need (debug remoting works fine
> > too), but please try with the original code first.
> >
> > On Jan 7, 2008 1:52 PM, martymusk <ma...@email.it> wrote:
> >
> >>
> >> Thank you very much...
> >> The exception is the same, I post it:
> >>
> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
> InOnly[
> >>  id: ID:192.168.0.172-11754495367-2:0
> >>  status: Done
> >>  role: provider
> >>  endpoint: endpoint
> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
> >> Example
> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> >> Job</fullname><description/><fireTime>Mon Jan 07 13:46:56 CET
> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> ]
> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus status
> =
> >> getStatus()
> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
> >> STATO
> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
> >> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >> DEBUG - JMSFlow                        - Called Flow send
> >> DEBUG - ActiveMQSession                - Sending message:
> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> messageId
> >> =
> >> ID:martina-39867-1199709997721-3:0:1:1:7, originalDestination = null,
> >> originalTransactionId = null, producerId =
> >> ID:martina-39867-1199709997721-3:0:1:1, destination =
> >> queue://org.apache.servicemix.jms.{
> >> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> ,
> >> transactionId = null, expiration = 0, timestamp = 1199710016807,
> arrival
> >> =
> >> 0, correlationId = null, replyTo = null, persistent = true, type =
> null,
> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
> null,
> >> compressed = false, userID = null, content =
> >> org.apache.activemq.util.ByteSequence@5ac5f, marshalledProperties =
> null,
> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
> null,
> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
> >> INFO  - DeliveryChannelImpl            - DOPO
> >> container.sendExchange(mirror);
> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> ERROR - JMSFlow                        - Caught an exception routing
> >> ExchangePacket:
> >> javax.jbi.messaging.MessagingException: illegal call to send / sendSync
> >>        at
> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> >> MessageExchangeImpl.java:581)
> >>        at
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> >> DeliveryChannelImpl.java:384)
> >>        at
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> >> DeliveryChannelImpl.java:444)
> >>        at
> >> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
> >> :249)
> >>        at
> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> >> SubscriberComponent.java:204)
> >>        at
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> >> DeliveryChannelImpl.java:621)
> >>        at
> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> >> AbstractFlow.java:174)
> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
> >> JMSFlow.java:1)
> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
> >> JMSFlow.java:543)
> >>        at
> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> >> (ThreadPoolExecutor.java:665)
> >>        at
> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> >> (ThreadPoolExecutor.java:690)
> >>        at java.lang.Thread.run(Thread.java:595)
> >> javax.jbi.messaging.MessagingException: illegal call to send / sendSync
> >>        at
> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> >> MessageExchangeImpl.java:581)
> >>        at
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> >> DeliveryChannelImpl.java:384)
> >>        at
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> >> DeliveryChannelImpl.java:444)
> >>        at
> >> org.apache.servicemix.components.util.PojoSupport.done(PojoSupport.java
> >> :193)
> >>        at
> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> >> SubscriberComponent.java:198)
> >>        at
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> >> DeliveryChannelImpl.java:621)
> >>        at
> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> >> AbstractFlow.java:174)
> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
> >> JMSFlow.java:1)
> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
> >> JMSFlow.java:543)
> >>        at
> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> >> (ThreadPoolExecutor.java:665)
> >>        at
> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> >> (ThreadPoolExecutor.java:690)
> >>        at java.lang.Thread.run(Thread.java:595)
> >>
> >> What do I do wrong?
> >> Thanks in advance!
> >>
> >> Martina
> >>
> >>
> >> gnodet wrote:
> >> >
> >> > Just before calling fail(exchange, e), could you display the stack
> >> trace
> >> > of
> >> > the exception ?
> >> >    e.printStackTrace()
> >> > and send this error ?
> >> > This is the real error, but it seems to be hidden by fail() throwing
> >> > another
> >> > excepiton.
> >> >
> >> > On Jan 7, 2008 12:32 PM, martymusk <ma...@email.it> wrote:
> >> >
> >> >>
> >> >> Hy gnodet,
> >> >> thank you for your felpfulness.
> >> >> Thus, I've used InOnly exchange, but I've the same error.
> >> >> I post you my class and the error.
> >> >>
> >> >> package org.apache.servicemix.wsn;
> >> >>
> >> >>
> >> >> import java.io.StringWriter;
> >> >>
> >> >> import javax.jbi.JBIException;
> >> >> import javax.jbi.messaging.ExchangeStatus;
> >> >> import javax.jbi.messaging.MessageExchange;
> >> >> import javax.jbi.messaging.MessagingException;
> >> >> import javax.jbi.messaging.NormalizedMessage;
> >> >> import javax.xml.bind.JAXBContext;
> >> >> import javax.xml.transform.Source;
> >> >> import javax.xml.transform.TransformerException;
> >> >>
> >> >> import org.apache.commons.logging.Log;
> >> >> import org.apache.commons.logging.LogFactory;
> >> >> import org.apache.servicemix.MessageExchangeListener;
> >> >> import org.apache.servicemix.components.util.ComponentSupport;
> >> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
> >> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
> >> >> import org.apache.servicemix.wsn.client.NotificationBroker;
> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
> >> >> import org.w3c.dom.Element;
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>  public class SubscriberComponent extends ComponentSupport
> implements
> >> >> MessageExchangeListener {
> >> >>
> >> >>            private static final Log log =
> >> >> LogFactory.getLog(SubscriberComponent.class);
> >> >>
> >> >>            private NotificationBroker wsnBroker;
> >> >>            private String receiveTopic;
> >> >>            private boolean demand;
> >> >>            private String subscriptionEndpoint = "subscription";
> >> >>            private Subscribe subscription;
> >> >>
> >> >>            /**
> >> >>             * @return Returns the demand.
> >> >>             */
> >> >>            public boolean getDemand() {
> >> >>                return demand;
> >> >>            }
> >> >>
> >> >>            /**
> >> >>             * @param demand The demand to set.
> >> >>             */
> >> >>            public void setDemand(boolean demand) {
> >> >>                this.demand = demand;
> >> >>            }
> >> >>
> >> >>            /**
> >> >>             * @return Returns the topic.
> >> >>             */
> >> >>            public String getTopic() {
> >> >>                return receiveTopic;
> >> >>            }
> >> >>
> >> >>            /**
> >> >>             * @param topic The topic to set.
> >> >>             */
> >> >>            public void setTopic(String receiveTopic) {
> >> >>                this.receiveTopic = receiveTopic;
> >> >>            }
> >> >>
> >> >>            /**
> >> >>             * @return Returns the subscription.
> >> >>             */
> >> >>            public Subscribe getSubscription() {
> >> >>                return subscription;
> >> >>            }
> >> >>
> >> >>            /* (non-Javadoc)
> >> >>             * @see
> >> >> org.apache.servicemix.jbi.management.BaseLifeCycle#init
> >> >> ()
> >> >>             */
> >> >>            public void init() throws JBIException {
> >> >>                super.init();
> >> >>                getContext().activateEndpoint(getService(),
> >> >> subscriptionEndpoint);
> >> >>            }
> >> >>
> >> >>            /* (non-Javadoc)
> >> >>             * @see javax.jbi.management.LifeCycleMBean#start()
> >> >>             */
> >> >>            public void start() throws JBIException {
> >> >>                new Thread() {
> >> >>                    public void run() {
> >> >>                        try {
> >> >>                            wsnBroker = new
> >> >> NotificationBroker(getContext());
> >> >>                            String wsaAddress =
> >> >> getService().getNamespaceURI() +
> >> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
> >> >>
> >> >> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
> >> >>                                                        receiveTopic,
> >> >>                                                        demand);
> >> >>                        } catch (Exception e) {
> >> >>                            log.error("Could not create wsn client",
> >> e);
> >> >>                        }
> >> >>                    }
> >> >>                }.start();
> >> >>            }
> >> >>
> >> >>
> >> >>            private SourceTransformer sourceTransformer = new
> >> >> SourceTransformer();
> >> >>
> >> >>            public SourceTransformer getSourceTransformer() {
> >> >>                        return sourceTransformer;
> >> >>                }
> >> >>
> >> >>                public void setSourceTransformer(SourceTransformer
> >> >> sourceTransformer) {
> >> >>                        this.sourceTransformer = sourceTransformer;
> >> >>                }
> >> >>
> >> >>            /* (non-Javadoc)
> >> >>             * @see javax.jbi.management.LifeCycleMBean#shutDown()
> >> >>             */
> >> >>            public void shutDown() throws JBIException {
> >> >>                super.shutDown();
> >> >>            }
> >> >>
> >> >>            /* (non-Javadoc)
> >> >>             * @see
> >> >> org.apache.servicemix.MessageExchangeListener#onMessageExchange(
> >> >> javax.jbi.messaging.MessageExchange)
> >> >>             */
> >> >>            public void onMessageExchange(MessageExchange exchange)
> >> throws
> >> >> MessagingException {
> >> >>
> >> >>                NormalizedMessage message = exchange.getMessage
> ("in");
> >> >>                        if (message == null) {
> >> >>                                log.warn("Received null message from
> >> >> exchange: " + exchange);
> >> >>                        } else {
> >> >>                                log.info("Exchange: " + exchange + "
> >> >> received IN message: "
> >> >>                                                + message);
> >> >>                                try {
> >> >>                                        log.info("Body is: "
> >> >>                                                        +
> >> >> sourceTransformer.toString(message.getContent()));
> >> >>                                } catch (TransformerException e) {
> >> >>                                        log.error("Failed to turn
> >> message
> >> >> body into text: " + e, e);
> >> >>                                }
> >> >>                        }
> >> >>                        done(exchange);
> >> >>                        log.info("MESSAGGIO RICEVUTO");
> >> >>
> >> >>                  log.info("COPIO IL PACCHETTO");
> >> >>
> >> >>                        MessageExchange scambio =
> >> >> (MessageExchange)exchange;
> >> >>                        log.info("IL PACCHETTO COPIATO E': "
> +scambio);
> >> >>
> >> >>
> >> >>                if (exchange.getStatus() != ExchangeStatus.DONE) {
> >> >>                        log.info("RITORNA PERCHE' LO STATO E': "
> >> >> +exchange.getStatus());
> >> >>                    return;
> >> >>                }
> >> >>                // This is a notification from the WSN broker
> >> >>                if
> >> >>
> >> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
> >> {
> >> >>                    try {
> >> >>                        JAXBContext jaxbContext =
> >> >> JAXBContext.newInstance(Subscribe.class);
> >> >>                        Source src = exchange.getMessage
> >> >> ("in").getContent();
> >> >>                        Object input =
> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
> >> >>                        if (input instanceof Subscribe) {
> >> >>                            subscription = (Subscribe) input;
> >> >>                            SubscribeResponse response = new
> >> >> SubscribeResponse();
> >> >>                            String wsaAddress =
> >> >> getService().getNamespaceURI() +
> >> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
> >> >>
> >> >> response.setSubscriptionReference(AbstractWSAClient.createWSA
> >> >> (wsaAddress));
> >> >>                            StringWriter writer = new StringWriter();
> >> >>                            jaxbContext.createMarshaller
> >> >> ().marshal(response,
> >> >> writer);
> >> >>                            NormalizedMessage out =
> >> exchange.createMessage
> >> >> ();
> >> >>                            out.setContent(new
> >> >> StringSource(writer.toString
> >> >> ()));
> >> >>                            exchange.setMessage(out, "out");
> >> >>                            send(exchange);
> >> >>
> >> >>                        } else if (input instanceof Unsubscribe) {
> >> >>                            subscription = null;
> >> >>                            UnsubscribeResponse response = new
> >> >> UnsubscribeResponse();
> >> >>                            StringWriter writer = new StringWriter();
> >> >>                            jaxbContext.createMarshaller
> >> >> ().marshal(response,
> >> >> writer);
> >> >>                            NormalizedMessage out =
> >> exchange.createMessage
> >> >> ();
> >> >>                            out.setContent(new
> >> >> StringSource(writer.toString
> >> >> ()));
> >> >>                            exchange.setMessage(out, "out");
> >> >>                            send(exchange);
> >> >>
> >> >>
> >> >>                        } else {
> >> >>                            throw new Exception("Unkown request");
> >> >>                        }
> >> >>                    } catch (Exception e) {
> >> >>                        fail(exchange, e);
> >> >>                    }
> >> >>                // This is a notification to publish
> >> >>                }
> >> >>
> >> >>                  else {
> >> >>                    try {
> >> >>                        if (!demand || subscription != null) {
> >> >>                            Element elem = new
> >> >> SourceTransformer().toDOMElement(exchange.getMessage("in"));
> >> >>                            wsnBroker.notify(receiveTopic, elem);
> >> >>                            done(exchange);
> >> >>                        } else {
> >> >>                            log.info("Ingore notification as the
> >> publisher
> >> >> is no
> >> >> subscribers");
> >> >>                        }
> >> >>                    } catch (Exception e) {
> >> >>                        fail(exchange, e);
> >> >>                        }
> >> >>                }
> >> >>            }
> >> >>
> >> >>  }
> >> >>
> >> >>  ......
> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >> >> DEBUG - JMSFlow                        - Called Flow send
> >> >> DEBUG - ActiveMQSession                - Sending message:
> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> >> messageId
> >> >> =
> >> >> ID:martina-39597-1199704995676-3:0:1:1:5, originalDestination =
> null,
> >> >> originalTransactionId = null, producerId =
> >> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
> >> >> queue://org.apache.servicemix.jms.{
> >> >>
> >> http://servicemix.apache.org/demo}trace:endpoint<http://servicemix.apache.org/demo%7Dtrace:endpoint>
> <http://servicemix.apache.org/demo%7Dtrace:endpoint>
> >> <http://servicemix.apache.org/demo%7Dtrace:endpoint>
> >> >> ,
> >> >> transactionId = null, expiration = 0, timestamp = 1199705011173,
> >> arrival
> >> >> =
> >> >> 0, correlationId = null, replyTo = null, persistent = true, type =
> >> null,
> >> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
> >> null,
> >> >> compressed = false, userID = null, content =
> >> >> org.apache.activemq.util.ByteSequence@10a69f0, marshalledProperties
> =
> >> >> null,
> >> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
> >> null,
> >> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
> >> >> INFO  - SubscriberComponent            - Exchange: InOnly[
> >> >>  id: ID:192.168.0.172-11753fdefba-2:0
> >> >>  status: Active
> >> >>  role: provider
> >> >>  endpoint: endpoint
> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> >> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >> >>
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
> >> >> Example
> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> >> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
> >> >>
> >> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> >> ] received IN message:
> >> >>
> >> >>
> >>
> org.apache.servicemix.jbi.messaging.NormalizedMessageImpl@b125bd{properties
> >> >> :
> >> >> {}}
> >> >> INFO  - SubscriberComponent            - Body is: <?xml version="1.0
> "
> >> >> encoding="UTF-8"?><ns2:Notify xmlns:ns2="
> >> >> http://docs.oasis-open.org/wsn/b-2"
> >> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >> >>
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
> >> >> Example
> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> >> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
> >> >>
> >> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
> >> status
> >> =
> >> >> getStatus()
> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA
> LO
> >> >> STATO
> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
> >> >> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >> >> DEBUG - JMSFlow                        - Called Flow send
> >> >> INFO  - DeliveryChannelImpl            - DOPO
> >> >> container.sendExchange(mirror);
> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> >> >> DEBUG - ActiveMQSession                - Sending message:
> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> >> messageId
> >> >> =
> >> >> ID:martina-39597-1199704995676-3:0:1:1:6, originalDestination =
> null,
> >> >> originalTransactionId = null, producerId =
> >> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
> >> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
> >> expiration
> >> >> =
> >> >> 0, timestamp = 1199705011183, arrival = 0, correlationId = null,
> >> replyTo
> >> >> =
> >> >> null, persistent = true, type = null, priority = 4, groupID = null,
> >> >> groupSequence = 0, targetConsumerId = null, compressed = false,
> userID
> >> =
> >> >> null, content = org.apache.activemq.util.ByteSequence@c70f32,
> >> >> marshalledProperties = null, dataStructure = null, redeliveryCounter
> =
> >> 0,
> >> >> size = 0, properties = null, readOnlyProperties = true, readOnlyBody
> =
> >> >> true,
> >> >> droppable = false}
> >> >> INFO  - DeliveryChannelImpl            - DOPO
> >> >> container.sendExchange(mirror);
> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> >> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> >> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> >> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
> >> InOnly[
> >> >>  id: ID:192.168.0.172-11753fdefba-2:0
> >> >>  status: Done
> >> >>  role: provider
> >> >>  endpoint: endpoint
> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> >> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >> >>
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
> >> >> Example
> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> >> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
> >> >>
> >> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> >> ]
> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
> >> status
> >> =
> >> >> getStatus()
> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA
> LO
> >> >> STATO
> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
> >> >> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >> >> DEBUG - JMSFlow                        - Called Flow send
> >> >> DEBUG - WSNSpringComponent             - Received exchange: status:
> >> Done,
> >> >> role: consumer
> >> >> DEBUG - WSNSpringComponent             - Retrieved correlation id:
> >> null
> >> >> DEBUG - ActiveMQSession                - Sending message:
> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> >> messageId
> >> >> =
> >> >> ID:martina-39597-1199704995676-3:0:1:1:7, originalDestination =
> null,
> >> >> originalTransactionId = null, producerId =
> >> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
> >> >> queue://org.apache.servicemix.jms.{
> >> >>
> >> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> >> ,
> >> >> transactionId = null, expiration = 0, timestamp = 1199705011188,
> >> arrival
> >> >> =
> >> >> 0, correlationId = null, replyTo = null, persistent = true, type =
> >> null,
> >> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
> >> null,
> >> >> compressed = false, userID = null, content =
> >> >> org.apache.activemq.util.ByteSequence@1c8f59c, marshalledProperties
> =
> >> >> null,
> >> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
> >> null,
> >> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
> >> >> INFO  - DeliveryChannelImpl            - DOPO
> >> >> container.sendExchange(mirror);
> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> ERROR - JMSFlow                        - Caught an exception routing
> >> >> ExchangePacket:
> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
> >> sendSync
> >> >>        at
> >> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> >> >> MessageExchangeImpl.java:581)
> >> >>        at
> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> >> >> DeliveryChannelImpl.java:384)
> >> >>        at
> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> >> >> DeliveryChannelImpl.java:444)
> >> >>        at
> >> >>
> >> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
> >> >> :249)
> >> >>        at
> >> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> >> >> SubscriberComponent.java:203)
> >> >>        at
> >> >>
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> >> >> DeliveryChannelImpl.java:621)
> >> >>        at
> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> >> >> AbstractFlow.java:174)
> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
> >> >> JMSFlow.java:1)
> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
> >> >> JMSFlow.java:543)
> >> >>        at
> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> >> >> (ThreadPoolExecutor.java:665)
> >> >>        at
> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> >> >> (ThreadPoolExecutor.java:690)
> >> >>        at java.lang.Thread.run(Thread.java:595)
> >> >>
> >> >> Can you help me again?
> >> >> Thanks in advance!
> >> >>
> >> >> Martina
> >> >>
> >> >>
> >> >>
> >> >> gnodet wrote:
> >> >> >
> >> >> > You need to use an InOnly or RobustInOnly exchange, not an InOut
> >> >> exchange,
> >> >> > as notifications do not have any out messages.
> >> >> >
> >> >> > On Jan 4, 2008 5:16 PM, martymusk <ma...@email.it> wrote:
> >> >> >
> >> >> >>
> >> >> >> Thus , I've created a new class "SubscriberComponent" that is a
> >> copy
> >> >> of
> >> >> >> PublisherComponent. Trhough it instance2 receive exchange and try
> >> to
> >> >> send
> >> >> >> scambio (copy of exchange). When I run example the following
> error
> >> >> >> occurs...
> >> >> >>
> >> >> >> DEBUG - JMSFlow                        - Called Flow send
> >> >> >> DEBUG - ActiveMQSession                - Sending message:
> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> >> >> messageId
> >> >> >> =
> >> >> >> ID:martina-38529-1199462112612-3:0:1:1:6, originalDestination =
> >> null,
> >> >> >> originalTransactionId = null, producerId =
> >> >> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
> >> >> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
> >> >> expiration
> >> >> >> =
> >> >> >> 0, timestamp = 1199462153935, arrival = 0, correlationId = null,
> >> >> replyTo
> >> >> >> =
> >> >> >> null, persistent = true, type = null, priority = 4, groupID =
> null,
> >> >> >> groupSequence = 0, targetConsumerId = null, compressed = false,
> >> userID
> >> >> =
> >> >> >> null, content = org.apache.activemq.util.ByteSequence@b2175,
> >> >> >> marshalledProperties = null, dataStructure = null,
> >> redeliveryCounter
> >> =
> >> >> 0,
> >> >> >> size = 0, properties = null, readOnlyProperties = true,
> >> readOnlyBody
> >> =
> >> >> >> true,
> >> >> >> droppable = false}
> >> >> >> DEBUG - WSNSpringComponent             - Received exchange:
> status:
> >> >> >> Active,
> >> >> >> role: consumer
> >> >> >> DEBUG - WSNSpringComponent             - Retrieved correlation
> id:
> >> >> null
> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
> >> >> >> container.sendExchange(mirror);
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> >> >> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> >> >> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> >> >> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
> >> >> InOut[
> >> >> >>  id: ID:192.168.0.172-1174583cdf9-2:0
> >> >> >>  status: Active
> >> >> >>  role: provider
> >> >> >>  endpoint: endpoint
> >> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> >> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> >> >> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >> >> >>
> >> >>
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing
> "><name>My
> >> >> >> Example
> >> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.MyExample
> >> >> >> Job</fullname><description/><fireTime>Fri Jan 04 16:55:53 CET
> >> >> >>
> >> >> >>
> >> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> >> >> ]
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
> >> >> status
> >> >> =
> >> >> >> getStatus()
> >> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E
> CAMBIA
> >> LO
> >> >> >> STATO
> >> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> me.handleSend(sync)
> >> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> >> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >> >> >> DEBUG - JMSFlow                        - Called Flow send
> >> >> >> DEBUG - ActiveMQSession                - Sending message:
> >> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> >> >> messageId
> >> >> >> =
> >> >> >> ID:martina-38529-1199462112612-3:0:1:1:7, originalDestination =
> >> null,
> >> >> >> originalTransactionId = null, producerId =
> >> >> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
> >> >> >> queue://org.apache.servicemix.jms.{
> >> >> >>
> >> >>
> >> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> >> >> ,
> >> >> >> transactionId = null, expiration = 0, timestamp = 1199462153952,
> >> >> arrival
> >> >> >> =
> >> >> >> 0, correlationId = null, replyTo = null, persistent = true, type
> =
> >> >> null,
> >> >> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId
> =
> >> >> null,
> >> >> >> compressed = false, userID = null, content =
> >> >> >> org.apache.activemq.util.ByteSequence@779b3e,
> marshalledProperties
> >> =
> >> >> >> null,
> >> >> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties
> =
> >> >> null,
> >> >> >> readOnlyProperties = true, readOnlyBody = true, droppable =
> false}
> >> >> >> INFO  - DeliveryChannelImpl            - DOPO
> >> >> >> container.sendExchange(mirror);
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> >> ERROR - JMSFlow                        - Caught an exception
> >> routing
> >> >> >> ExchangePacket:
> >> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
> >> >> sendSync
> >> >> >>        at
> >> >> >>
> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> >> >> >> MessageExchangeImpl.java:581)
> >> >> >>        at
> >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> >> >> >> DeliveryChannelImpl.java:384)
> >> >> >>        at
> >> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> >> >> >> DeliveryChannelImpl.java:444)
> >> >> >>        at
> >> >> >>
> >> >>
> >> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
> >> >> >> :249)
> >> >> >>        at
> >> >> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> >> >> >> SubscriberComponent.java:203)
> >> >> >>        at
> >> >> >>
> >> >>
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> >> >> >> DeliveryChannelImpl.java:621)
> >> >> >>        at
> >> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> >> >> >> AbstractFlow.java:174)
> >> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3
> (
> >> >> >> JMSFlow.java:1)
> >> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
> >> >> >> JMSFlow.java:543)
> >> >> >>        at
> >> >> >>
> >> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> >> >> >> (ThreadPoolExecutor.java:665)
> >> >> >>        at
> >> >> >>
> >> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> >> >> >> (ThreadPoolExecutor.java:690)
> >> >> >>        at java.lang.Thread.run(Thread.java:595)
> >> >> >>
> >> >> >> I do wrong again?
> >> >> >>
> >> >> >> Thank you!!!
> >> >> >> Martina
> >> >> >>
> >> >> >>
> >> >> >> gnodet wrote:
> >> >> >> >
> >> >> >> > You should have a look at the existing code:
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >>
> >>
> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/spring/PublisherComponent.java?r=602828
> >> >> >> >
> >> >> >> > Note that the publisher component actually use the client api
> >> (line
> >> >> >> 172).
> >> >> >> > For details on thow the client api works (which is how to send
> a
> >> JBI
> >> >> >> > exchange to the WSN broker), see:
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >>
> >>
> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/client/NotificationBroker.java?r=602828#l89
> >> >> >> >
> >> >> >> > I would advise you to start from the publisher component, copy
> it
> >> >> and
> >> >> >> use
> >> >> >> > it
> >> >> >> > instead of your TraceComponent.
> >> >> >> > Each time it receives a JBI exchange, it will publish it
> through
> >> the
> >> >> >> > WSNotification broker.
> >> >> >> >
> >> >> >> > Also look at the various resources on the web site that may
> help
> >> >> you:
> >> >> >> >   http://servicemix.apache.org/servicemix-wsn2005.html
> >> >> >> >   http://servicemix.apache.org/example-scenario.html
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> > On Jan 4, 2008 2:58 PM, martymusk <ma...@email.it> wrote:
> >> >> >> >
> >> >> >> >>
> >> >> >> >> Hy gnodet and thank you very much for your helpfulness,
> >> >> >> >> but I don't understand exactly what I must to do.
> >> >> >> >>
> >> >> >> >> How can I send JBI exchange to the WSN broker directly?
> >> >> >> >> How can I use WSN client api.
> >> >> >> >>
> >> >> >> >> I'm working for a thesis at University of Naples.
> >> >> >> >> My purpose is to study WSN performance.
> >> >> >> >> I've found your WSN implementation very useful for me, but to
> >> study
> >> >> >> >> performance, I need exchange was send back.
> >> >> >> >> It is more than a mounth I'm triyng to do this.
> >> >> >> >>
> >> >> >> >> I would be very grateful if you can help me. Otherwise, there
> >> are
> >> >> no
> >> >> >> >> problems, I'll keep on study over and over again, hoping I be
> >> able
> >> >> to
> >> >> >> >> achieve my purpose.
> >> >> >> >>
> >> >> >> >> Thank you very much.
> >> >> >> >> Martina
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> gnodet wrote:
> >> >> >> >> >
> >> >> >> >> > I thought I pointed you to the right direction.
> >> >> >> >> > Do not use the PublisherComponent that way: either use it as
> >> it
> >> >> is
> >> >> >> >> > intended
> >> >> >> >> > (deploy it as a component onto the lightweight container) or
> >> use
> >> >> the
> >> >> >> >> WSN
> >> >> >> >> > client api:
> >> >> >> >> >    wsn.notify(topic, msg)
> >> >> >> >> >
> >> >> >> >> > I'm not sure what you are trying to achieve with your
> >> >> >> TraceComponent.
> >> >> >> >>  It
> >> >> >> >> > sounds like you want to reimplement the PublisherComponent.
> >> If
> >> >> so,
> >> >> >> you
> >> >> >> >> > should have a look at how it is implemented and patch it.
> >> >> >> >> >
> >> >> >> >> > Also note that both PublisherComponent and the WSN client
> api
> >> are
> >> >> >> just
> >> >> >> >> > sugar, you can send a JBI exchange to the WSN broker
> directly
> >> if
> >> >> you
> >> >> >> >> want.
> >> >> >> >> >
> >> >> >> >> > On Jan 4, 2008 2:13 PM, martymusk <ma...@email.it>
> wrote:
> >> >> >> >> >
> >> >> >> >> >>
> >> >> >> >> >> My problem is always the same!
> >> >> >> >> >> In wsn-example, after Consumer received an exchange, I'd
> like
> >> it
> >> >> >> send
> >> >> >> >> >> copy
> >> >> >> >> >> of it. But it doesn't happen. :-(
> >> >> >> >> >> I've modified TraceComponent class in the following way,
> but
> >> it
> >> >> >> >> doesn't
> >> >> >> >> >> work
> >> >> >> >> >> fine:
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> package org.apache.servicemix.wsn;
> >> >> >> >> >>
> >> >> >> >> >> import java.io.StringWriter;
> >> >> >> >> >>
> >> >> >> >> >> import javax.jbi.JBIException;
> >> >> >> >> >> import javax.jbi.messaging.ExchangeStatus;
> >> >> >> >> >> import javax.jbi.messaging.MessageExchange;
> >> >> >> >> >> import javax.jbi.messaging.MessagingException;
> >> >> >> >> >> import javax.jbi.messaging.NormalizedMessage;
> >> >> >> >> >> import javax.xml.bind.JAXBContext;
> >> >> >> >> >> import javax.xml.transform.Source;
> >> >> >> >> >> import javax.xml.transform.TransformerException;
> >> >> >> >> >> //import javax.jbi.messaging.InOut;
> >> >> >> >> >>
> >> >> >> >> >> import
> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl
> >> ;
> >> >> >> >> >> import org.apache.servicemix.jbi.messaging.InOutImpl;
> >> >> >> >> >> import org.apache.commons.logging.Log;
> >> >> >> >> >> import org.apache.commons.logging.LogFactory;
> >> >> >> >> >> import org.apache.servicemix.MessageExchangeListener;
> >> >> >> >> >> import
> >> org.apache.servicemix.components.util.ComponentSupport;
> >> >> >> >> >> import org.apache.servicemix.wsn.spring.PublisherComponent;
> >> >> >> >> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
> >> >> >> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
> >> >> >> >> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
> >> >> >> >> >> import org.apache.servicemix.wsn.client.NotificationBroker;
> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
> >> >> >> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
> >> >> >> >> >> import org.w3c.dom.Element;
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> public class TraceComponent extends ComponentSupport
> >> implements
> >> >> >> >> >>                MessageExchangeListener {
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>        private Log log =
> >> >> LogFactory.getLog(TraceComponent.class);
> >> >> >> >> >>
> >> >> >> >> >>        private SourceTransformer sourceTransformer = new
> >> >> >> >> >> SourceTransformer();
> >> >> >> >> >>
> >> >> >> >> >>        public Log getLog() {
> >> >> >> >> >>                return log;
> >> >> >> >> >>        }
> >> >> >> >> >>
> >> >> >> >> >>        public void setLog(Log log) {
> >> >> >> >> >>                this.log = log;
> >> >> >> >> >>        }
> >> >> >> >> >>
> >> >> >> >> >>        public SourceTransformer getSourceTransformer() {
> >> >> >> >> >>                return sourceTransformer;
> >> >> >> >> >>        }
> >> >> >> >> >>
> >> >> >> >> >>        public void setSourceTransformer(SourceTransformer
> >> >> >> >> >> sourceTransformer) {
> >> >> >> >> >>                this.sourceTransformer = sourceTransformer;
> >> >> >> >> >>        }
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>        //AGGIUNGO CODICE
> >> >> >> >> >>
> >> >> >> >> >>        PublisherComponent publisher = new
> >> PublisherComponent();
> >> >> >> >> >>          private String subscriptionEndpoint =
> >> "subscription";
> >> >> >> >> >>          private NotificationBroker wsnBroker;
> >> >> >> >> >>          private String topic;
> >> >> >> >> >>          private String msg;
> >> >> >> >> >>          private boolean demand;
> >> >> >> >> >>          private Subscribe subscription;
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>          public String getTopic() {
> >> >> >> >> >>                return topic;
> >> >> >> >> >>            }
> >> >> >> >> >>
> >> >> >> >> >>            /**
> >> >> >> >> >>             * @param topic The topic to set.
> >> >> >> >> >>             */
> >> >> >> >> >>            public void setTopic(String topic) {
> >> >> >> >> >>               this.topic = topic;
> >> >> >> >> >>            }
> >> >> >> >> >>
> >> >> >> >> >>         public void init() throws JBIException {
> >> >> >> >> >>                super.init();
> >> >> >> >> >>                getContext().activateEndpoint(getService(),
> >> >> >> >> >> subscriptionEndpoint);
> >> >> >> >> >>                 log.info("METODO INIT");
> >> >> >> >> >>                // publisher.init();
> >> >> >> >> >>
> >> >> >> >> >>                 publisher.setTopic(topic);
> >> >> >> >> >>            }
> >> >> >> >> >>
> >> >> >> >> >>            /* (non-Javadoc)
> >> >> >> >> >>             * @see
> >> javax.jbi.management.LifeCycleMBean#start()
> >> >> >> >> >>             */
> >> >> >> >> >>            public void start() throws JBIException {
> >> >> >> >> >>
> >> >> >> >> >>                log.info("METODO START");
> >> >> >> >> >>                //publisher.start();
> >> >> >> >> >>                new Thread() {
> >> >> >> >> >>                  public void run() {
> >> >> >> >> >>                       try {
> >> >> >> >> >>                           wsnBroker = new
> >> >> >> >> >> NotificationBroker(getContext());
> >> >> >> >> >>
> >> >> >> >> >>                           String wsaAddress =
> >> >> >> >> >> getService().getNamespaceURI() + "/"
> >> >> >> >> >> + getService().getLocalPart() + "/" + subscriptionEndpoint;
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >>
> >> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
> >> >> >> >> >>
> topic,
> >> >> >> >> >>
> >>  demand);
> >> >> >> >> >>                        } catch (Exception e) {
> >> >> >> >> >>                            log.error("Could not create wsn
> >> >> client",
> >> >> >> >> e);
> >> >> >> >> >>                        }
> >> >> >> >> >>                    }
> >> >> >> >> >>                }.start();
> >> >> >> >> >>            }
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>            public void shutDown() throws JBIException {
> >> >> >> >> >>                log.info("METODO SHUTDOWN");
> >> >> >> >> >>            //  publisher.shutDown();
> >> >> >> >> >>               super.shutDown();
> >> >> >> >> >>            }
> >> >> >> >> >>
> >> >> >> >> >>            //FINE CODICE AGGIUNTO
> >> >> >> >> >>
> >> >> >> >> >>        public void onMessageExchange(MessageExchange
> >> exchange)
> >> >> >> >> >>                        throws MessagingException {
> >> >> >> >> >>                // lets dump the incoming message
> >> >> >> >> >>                NormalizedMessage message =
> >> exchange.getMessage
> >> >> >> ("in");
> >> >> >> >> >>                if (message == null) {
> >> >> >> >> >>                        log.warn("Received null message from
> >> >> >> exchange:
> >> >> >> >> "
> >> >> >> >> +
> >> >> >> >> >> exchange);
> >> >> >> >> >>                } else {
> >> >> >> >> >>                        log.info("Exchange: " + exchange + "
> >> >> >> received
> >> >> >> >> IN
> >> >> >> >> >> message: "
> >> >> >> >> >>                                        + message);
> >> >> >> >> >>                        try {
> >> >> >> >> >>                                log.info("Body is: "
> >> >> >> >> >>                                                +
> >> >> >> >> >> sourceTransformer.toString(message.getContent()));
> >> >> >> >> >>                        } catch (TransformerException e) {
> >> >> >> >> >>                                log.error("Failed to turn
> >> message
> >> >> >> body
> >> >> >> >> >> into
> >> >> >> >> >> text: " + e, e);
> >> >> >> >> >>                        }
> >> >> >> >> >>                }
> >> >> >> >> >>                done(exchange);
> >> >> >> >> >>                log.info("MESSAGGIO RICEVUTO");
> >> >> >> >> >>
> >> >> >> >> >>                log.info("COPIO IL PACCHETTO");
> >> >> >> >> >>
> >> >> >> >> >>                MessageExchange scambio =
> >> >> (MessageExchange)exchange;
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>                log.info("INVIO");
> >> >> >> >> >>
> >> >> >> >> >>          try{
> >> >> >> >> >>
> >> >> >> >> >>                log.info("FASE INVIO");
> >> >> >> >> >>                //publisher.onMessageExchange(scambio);
> >> >> >> >> >>
> >> >> >> >> >>                //AGGIUNGO onMessageExchange
> >> >> >> >> >>
> >> >> >> >> >>                if (exchange.getStatus() !=
> >> >> ExchangeStatus.ACTIVE)
> >> >> {
> >> >> >> >> >>                    return;
> >> >> >> >> >>                }
> >> >> >> >> >>                // This is a notification from the WSN
> broker
> >> >> >> >> >>                if
> >> >> >> >> >>
> >> >> >> >>
> >> >> >>
> >> >>
> >> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
> >> >> >> >> {
> >> >> >> >> >>                    try {
> >> >> >> >> >>                        JAXBContext jaxbContext =
> >> >> >> >> >> JAXBContext.newInstance(Subscribe.class);
> >> >> >> >> >>                        Source src = exchange.getMessage
> >> >> >> >> >> ("in").getContent();
> >> >> >> >> >>                        Object input =
> >> >> >> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
> >> >> >> >> >>                        if (input instanceof Subscribe) {
> >> >> >> >> >>                            subscription = (Subscribe)
> input;
> >> >> >> >> >>                            SubscribeResponse response = new
> >> >> >> >> >> SubscribeResponse();
> >> >> >> >> >>                            String wsaAddress =
> >> >> >> >> >> getService().getNamespaceURI() +
> >> >> >> >> >> "/" + getService().getLocalPart() + "/" +
> >> subscriptionEndpoint;
> >> >> >> >> >>
> >> >> >> >> >> response.setSubscriptionReference(
> AbstractWSAClient.createWSA
> >> >> >> >> >> (wsaAddress));
> >> >> >> >> >>                            StringWriter writer = new
> >> >> >> StringWriter();
> >> >> >> >> >>                            jaxbContext.createMarshaller
> >> >> >> >> >> ().marshal(response,
> >> >> >> >> >> writer);
> >> >> >> >> >>                            NormalizedMessage out =
> >> >> >> >> exchange.createMessage
> >> >> >> >> >> ();
> >> >> >> >> >>                            out.setContent(new
> >> >> >> >> >> StringSource(writer.toString
> >> >> >> >> >> ()));
> >> >> >> >> >>                            exchange.setMessage(out, "out");
> >> >> >> >> >>                            send(exchange);
> >> >> >> >> >>
> >> >> >> >> >>                        } else if (input instanceof
> >> Unsubscribe)
> >> >> {
> >> >> >> >> >>                            subscription = null;
> >> >> >> >> >>                            UnsubscribeResponse response =
> new
> >> >> >> >> >> UnsubscribeResponse();
> >> >> >> >> >>                            StringWriter writer = new
> >> >> >> StringWriter();
> >> >> >> >> >>                            jaxbContext.createMarshaller
> >> >> >> >> >> ().marshal(response,
> >> >> >> >> >> writer);
> >> >> >> >> >>                            NormalizedMessage out =
> >> >> >> >> exchange.createMessage
> >> >> >> >> >> ();
> >> >> >> >> >>                            out.setContent(new
> >> >> >> >> >> StringSource(writer.toString
> >> >> >> >> >> ()));
> >> >> >> >> >>                            exchange.setMessage(out, "out");
> >> >> >> >> >>                            send(exchange);
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>                        } else {
> >> >> >> >> >>                            throw new Exception("Unkown
> >> >> request");
> >> >> >> >> >>                        }
> >> >> >> >> >>                    } catch (Exception e) {
> >> >> >> >> >>                        fail(exchange, e);
> >> >> >> >> >>                    }
> >> >> >> >> >>                // This is a notification to publish
> >> >> >> >> >>                }
> >> >> >> >> >>
> >> >> >> >> >>                  else {
> >> >> >> >> >>                    try {
> >> >> >> >> >>
> >> >> >> >> >>                    log.info("SALTA");
> >> >> >> >> >>                        if (!demand || subscription != null)
> {
> >> >> >> >> >>                                log.info("ENTRO NELL'IF");
> >> >> >> >> >>                           // Element elem = new
> >> >> >> >> >> SourceTransformer().toDOMElement(exchange.getMessage
> ("in"));
> >> >> >> >> >>                            log.info("PRIMA DI WSNBROKER");
> >> >> >> >> >>                            wsnBroker.notify(topic, msg);
> >> >> >> >> >>                            log.info("PRIMA DI DONE");
> >> >> >> >> >>
> >>  getDeliveryChannel().send(exchange);
> >> >> >> >> >>                            log.info("DOPO DI DONE");
> >> >> >> >> >>                        } else {
> >> >> >> >> >>                            log.info("Ingore notification as
> >> the
> >> >> >> >> publisher
> >> >> >> >> >> is no
> >> >> >> >> >> subscribers");
> >> >> >> >> >>                        }
> >> >> >> >> >>                    } catch (Exception e) {
> >> >> >> >> >>                        fail(exchange, e);
> >> >> >> >> >>                        }
> >> >> >> >> >>
> >> >> >> >> >>                log.debug("IL PACCHETTO INVIATO E': " +
> >> scambio);
> >> >> >> >> >>
> >> >> >> >> >>                  }
> >> >> >> >> >>                //FINE onMessageExchange
> >> >> >> >> >>
> >> >> >> >> >>           } catch(JBIException e){
> >> >> >> >> >>                  log.error("ECCEZIONE GENERATA!");
> >> >> >> >> >>          }
> >> >> >> >> >>
> >> >> >> >> >>      log.info("INVIATO");
> >> >> >> >> >> }
> >> >> >> >> >> }
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> Help me if you can.
> >> >> >> >> >> Thank you very much for your helpfulness...
> >> >> >> >> >>
> >> >> >> >> >> Martina
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >> gnodet wrote:
> >> >> >> >> >> >
> >> >> >> >> >> > You should not have to deal nor see the internal state of
> >> the
> >> >> >> >> exchange.
> >> >> >> >> >> > If guess you have an exception when trying to send an
> >> >> exchange,
> >> >> >> but
> >> >> >> >> >> this
> >> >> >> >> >> > means that there is a problem in your code.  You should
> >> post
> >> a
> >> >> >> >> snippet
> >> >> >> >> >> of
> >> >> >> >> >> > your code that is failing so that we can help you.
> >> >> >> >> >> >
> >> >> >> >> >> > On Jan 4, 2008 12:22 PM, martymusk <ma...@email.it>
> >> wrote:
> >> >> >> >> >> >
> >> >> >> >> >> >>
> >> >> >> >> >> >> Hy,
> >> >> >> >> >> >> I've a question...
> >> >> >> >> >> >> can I set anywhere Consumer to CAN_SEND?
> >> >> >> >> >> >>
> >> >> >> >> >> >> I hope you can help me.
> >> >> >> >> >> >> Thank you in advance.
> >> >> >> >> >> >>
> >> >> >> >> >> >> Martina
> >> >> >> >> >> >> --
> >> >> >> >> >> >> View this message in context:
> >> >> >> >> >> >>
> >> >> >> >>
> >> >>
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
> >> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
> >> >> >> Nabble.com.
> >> >> >> >> >> >>
> >> >> >> >> >> >>
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >> > --
> >> >> >> >> >> > Cheers,
> >> >> >> >> >> > Guillaume Nodet
> >> >> >> >> >> > ------------------------
> >> >> >> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >>
> >> >> >> >> >> --
> >> >> >> >> >> View this message in context:
> >> >> >> >> >>
> >> >> >>
> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616107.html
> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
> >> >> Nabble.com.
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > --
> >> >> >> >> > Cheers,
> >> >> >> >> > Guillaume Nodet
> >> >> >> >> > ------------------------
> >> >> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >> --
> >> >> >> >> View this message in context:
> >> >> >> >>
> >> >>
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616748.html
> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
> >> Nabble.com.
> >> >> >> >>
> >> >> >> >>
> >> >> >> >
> >> >> >> >
> >> >> >> > --
> >> >> >> > Cheers,
> >> >> >> > Guillaume Nodet
> >> >> >> > ------------------------
> >> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context:
> >> >> >>
> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14619757.html
> >> >> >> Sent from the ServiceMix - User mailing list archive at
> Nabble.com.
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >> > --
> >> >> > Cheers,
> >> >> > Guillaume Nodet
> >> >> > ------------------------
> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14663812.html
> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > Cheers,
> >> > Guillaume Nodet
> >> > ------------------------
> >> > Blog: http://gnodet.blogspot.com/
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14664874.html
> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> > ------------------------
> > Blog: http://gnodet.blogspot.com/
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14665988.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: Consumer Can Send

Posted by martymusk <ma...@email.it>.
I've tried with original code, and it returns because status is DONE.
I post output obtained with original code:

DEBUG - WSNSpringComponent             - Received exchange: status: Done,
role: consumer
DEBUG - WSNSpringComponent             - Retrieved correlation id: null
INFO  - DeliveryChannelImpl            - DOPO
container.sendExchange(mirror);
INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
INFO  - DeliveryChannelImpl            - TERMINE DI doSend
INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
INFO  - SubscriberComponent            - COPIO IL PACCHETTO
INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E': InOnly[
  id: ID:192.168.0.172-1175476963a-2:0
  status: Done
  role: provider
  endpoint: endpoint
  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
xmlns="http://www.w3.org/2005/08/addressing"
xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
xmlns:ns4="http://docs.oasis-open.org/wsn/t-1"><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My Example
Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
Job</fullname><description/><fireTime>Mon Jan 07 14:35:12 CET
2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
]
INFO  - SubscriberComponent            - RETURNS BECAUSE STATUS IS: Done

So I've tried to modify ACTIVE with DONE, hoping it carry on, but it fails
with error I've posted previously.

I don't understand what I do wrong!
It's more than a mounth I'm trying to return back exchange. :-(

Thank you very much for help you give me!

Martina



gnodet wrote:
> 
> Have you tried with the original code before modifying the class from
> ServiceMix ?
> The first lines of the SubscriberComponent#onMessageExchange are
> 
>  if (exchange.getStatus() != ExchangeStatus.ACTIVE) {
>      return;
>  }
> 
> This is because you have to ignore exchanges in an Error / Done status.
> From the code you pasted, it seems you removed those lines and instead do
> some copy work and call done() which will fail for exchanges that are not
> active.
> 
> You can add debugging statements if you need (debug remoting works fine
> too), but please try with the original code first.
> 
> On Jan 7, 2008 1:52 PM, martymusk <ma...@email.it> wrote:
> 
>>
>> Thank you very much...
>> The exception is the same, I post it:
>>
>> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E': InOnly[
>>  id: ID:192.168.0.172-11754495367-2:0
>>  status: Done
>>  role: provider
>>  endpoint: endpoint
>>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> xmlns="http://www.w3.org/2005/08/addressing"
>> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> Example
>> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> Job</fullname><description/><fireTime>Mon Jan 07 13:46:56 CET
>>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> ]
>> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
>> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus status =
>> getStatus()
>> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
>> STATO
>> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
>> INFO  - DeliveryChannelImpl            - DOPO DI
>> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> DEBUG - JMSFlow                        - Called Flow send
>> DEBUG - ActiveMQSession                - Sending message:
>> ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId
>> =
>> ID:martina-39867-1199709997721-3:0:1:1:7, originalDestination = null,
>> originalTransactionId = null, producerId =
>> ID:martina-39867-1199709997721-3:0:1:1, destination =
>> queue://org.apache.servicemix.jms.{
>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> ,
>> transactionId = null, expiration = 0, timestamp = 1199710016807, arrival
>> =
>> 0, correlationId = null, replyTo = null, persistent = true, type = null,
>> priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
>> compressed = false, userID = null, content =
>> org.apache.activemq.util.ByteSequence@5ac5f, marshalledProperties = null,
>> dataStructure = null, redeliveryCounter = 0, size = 0, properties = null,
>> readOnlyProperties = true, readOnlyBody = true, droppable = false}
>> INFO  - DeliveryChannelImpl            - DOPO
>> container.sendExchange(mirror);
>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> ERROR - JMSFlow                        - Caught an exception routing
>> ExchangePacket:
>> javax.jbi.messaging.MessagingException: illegal call to send / sendSync
>>        at
>> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> MessageExchangeImpl.java:581)
>>        at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>> DeliveryChannelImpl.java:384)
>>        at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> DeliveryChannelImpl.java:444)
>>        at
>> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
>> :249)
>>        at
>> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> SubscriberComponent.java:204)
>>        at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> DeliveryChannelImpl.java:621)
>>        at
>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> AbstractFlow.java:174)
>>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
>> JMSFlow.java:1)
>>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>> JMSFlow.java:543)
>>        at
>>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> (ThreadPoolExecutor.java:665)
>>        at
>>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> (ThreadPoolExecutor.java:690)
>>        at java.lang.Thread.run(Thread.java:595)
>> javax.jbi.messaging.MessagingException: illegal call to send / sendSync
>>        at
>> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> MessageExchangeImpl.java:581)
>>        at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>> DeliveryChannelImpl.java:384)
>>        at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> DeliveryChannelImpl.java:444)
>>        at
>> org.apache.servicemix.components.util.PojoSupport.done(PojoSupport.java
>> :193)
>>        at
>> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> SubscriberComponent.java:198)
>>        at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> DeliveryChannelImpl.java:621)
>>        at
>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> AbstractFlow.java:174)
>>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
>> JMSFlow.java:1)
>>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>> JMSFlow.java:543)
>>        at
>>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> (ThreadPoolExecutor.java:665)
>>        at
>>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> (ThreadPoolExecutor.java:690)
>>        at java.lang.Thread.run(Thread.java:595)
>>
>> What do I do wrong?
>> Thanks in advance!
>>
>> Martina
>>
>>
>> gnodet wrote:
>> >
>> > Just before calling fail(exchange, e), could you display the stack
>> trace
>> > of
>> > the exception ?
>> >    e.printStackTrace()
>> > and send this error ?
>> > This is the real error, but it seems to be hidden by fail() throwing
>> > another
>> > excepiton.
>> >
>> > On Jan 7, 2008 12:32 PM, martymusk <ma...@email.it> wrote:
>> >
>> >>
>> >> Hy gnodet,
>> >> thank you for your felpfulness.
>> >> Thus, I've used InOnly exchange, but I've the same error.
>> >> I post you my class and the error.
>> >>
>> >> package org.apache.servicemix.wsn;
>> >>
>> >>
>> >> import java.io.StringWriter;
>> >>
>> >> import javax.jbi.JBIException;
>> >> import javax.jbi.messaging.ExchangeStatus;
>> >> import javax.jbi.messaging.MessageExchange;
>> >> import javax.jbi.messaging.MessagingException;
>> >> import javax.jbi.messaging.NormalizedMessage;
>> >> import javax.xml.bind.JAXBContext;
>> >> import javax.xml.transform.Source;
>> >> import javax.xml.transform.TransformerException;
>> >>
>> >> import org.apache.commons.logging.Log;
>> >> import org.apache.commons.logging.LogFactory;
>> >> import org.apache.servicemix.MessageExchangeListener;
>> >> import org.apache.servicemix.components.util.ComponentSupport;
>> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
>> >> import org.apache.servicemix.jbi.jaxp.StringSource;
>> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
>> >> import org.apache.servicemix.wsn.client.NotificationBroker;
>> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
>> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
>> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
>> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
>> >> import org.w3c.dom.Element;
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>  public class SubscriberComponent extends ComponentSupport implements
>> >> MessageExchangeListener {
>> >>
>> >>            private static final Log log =
>> >> LogFactory.getLog(SubscriberComponent.class);
>> >>
>> >>            private NotificationBroker wsnBroker;
>> >>            private String receiveTopic;
>> >>            private boolean demand;
>> >>            private String subscriptionEndpoint = "subscription";
>> >>            private Subscribe subscription;
>> >>
>> >>            /**
>> >>             * @return Returns the demand.
>> >>             */
>> >>            public boolean getDemand() {
>> >>                return demand;
>> >>            }
>> >>
>> >>            /**
>> >>             * @param demand The demand to set.
>> >>             */
>> >>            public void setDemand(boolean demand) {
>> >>                this.demand = demand;
>> >>            }
>> >>
>> >>            /**
>> >>             * @return Returns the topic.
>> >>             */
>> >>            public String getTopic() {
>> >>                return receiveTopic;
>> >>            }
>> >>
>> >>            /**
>> >>             * @param topic The topic to set.
>> >>             */
>> >>            public void setTopic(String receiveTopic) {
>> >>                this.receiveTopic = receiveTopic;
>> >>            }
>> >>
>> >>            /**
>> >>             * @return Returns the subscription.
>> >>             */
>> >>            public Subscribe getSubscription() {
>> >>                return subscription;
>> >>            }
>> >>
>> >>            /* (non-Javadoc)
>> >>             * @see
>> >> org.apache.servicemix.jbi.management.BaseLifeCycle#init
>> >> ()
>> >>             */
>> >>            public void init() throws JBIException {
>> >>                super.init();
>> >>                getContext().activateEndpoint(getService(),
>> >> subscriptionEndpoint);
>> >>            }
>> >>
>> >>            /* (non-Javadoc)
>> >>             * @see javax.jbi.management.LifeCycleMBean#start()
>> >>             */
>> >>            public void start() throws JBIException {
>> >>                new Thread() {
>> >>                    public void run() {
>> >>                        try {
>> >>                            wsnBroker = new
>> >> NotificationBroker(getContext());
>> >>                            String wsaAddress =
>> >> getService().getNamespaceURI() +
>> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>> >>
>> >> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
>> >>                                                        receiveTopic,
>> >>                                                        demand);
>> >>                        } catch (Exception e) {
>> >>                            log.error("Could not create wsn client",
>> e);
>> >>                        }
>> >>                    }
>> >>                }.start();
>> >>            }
>> >>
>> >>
>> >>            private SourceTransformer sourceTransformer = new
>> >> SourceTransformer();
>> >>
>> >>            public SourceTransformer getSourceTransformer() {
>> >>                        return sourceTransformer;
>> >>                }
>> >>
>> >>                public void setSourceTransformer(SourceTransformer
>> >> sourceTransformer) {
>> >>                        this.sourceTransformer = sourceTransformer;
>> >>                }
>> >>
>> >>            /* (non-Javadoc)
>> >>             * @see javax.jbi.management.LifeCycleMBean#shutDown()
>> >>             */
>> >>            public void shutDown() throws JBIException {
>> >>                super.shutDown();
>> >>            }
>> >>
>> >>            /* (non-Javadoc)
>> >>             * @see
>> >> org.apache.servicemix.MessageExchangeListener#onMessageExchange(
>> >> javax.jbi.messaging.MessageExchange)
>> >>             */
>> >>            public void onMessageExchange(MessageExchange exchange)
>> throws
>> >> MessagingException {
>> >>
>> >>                NormalizedMessage message = exchange.getMessage("in");
>> >>                        if (message == null) {
>> >>                                log.warn("Received null message from
>> >> exchange: " + exchange);
>> >>                        } else {
>> >>                                log.info("Exchange: " + exchange + "
>> >> received IN message: "
>> >>                                                + message);
>> >>                                try {
>> >>                                        log.info("Body is: "
>> >>                                                        +
>> >> sourceTransformer.toString(message.getContent()));
>> >>                                } catch (TransformerException e) {
>> >>                                        log.error("Failed to turn
>> message
>> >> body into text: " + e, e);
>> >>                                }
>> >>                        }
>> >>                        done(exchange);
>> >>                        log.info("MESSAGGIO RICEVUTO");
>> >>
>> >>                  log.info("COPIO IL PACCHETTO");
>> >>
>> >>                        MessageExchange scambio =
>> >> (MessageExchange)exchange;
>> >>                        log.info("IL PACCHETTO COPIATO E': " +scambio);
>> >>
>> >>
>> >>                if (exchange.getStatus() != ExchangeStatus.DONE) {
>> >>                        log.info("RITORNA PERCHE' LO STATO E': "
>> >> +exchange.getStatus());
>> >>                    return;
>> >>                }
>> >>                // This is a notification from the WSN broker
>> >>                if
>> >>
>> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
>> {
>> >>                    try {
>> >>                        JAXBContext jaxbContext =
>> >> JAXBContext.newInstance(Subscribe.class);
>> >>                        Source src = exchange.getMessage
>> >> ("in").getContent();
>> >>                        Object input =
>> >> jaxbContext.createUnmarshaller().unmarshal(src);
>> >>                        if (input instanceof Subscribe) {
>> >>                            subscription = (Subscribe) input;
>> >>                            SubscribeResponse response = new
>> >> SubscribeResponse();
>> >>                            String wsaAddress =
>> >> getService().getNamespaceURI() +
>> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>> >>
>> >> response.setSubscriptionReference(AbstractWSAClient.createWSA
>> >> (wsaAddress));
>> >>                            StringWriter writer = new StringWriter();
>> >>                            jaxbContext.createMarshaller
>> >> ().marshal(response,
>> >> writer);
>> >>                            NormalizedMessage out =
>> exchange.createMessage
>> >> ();
>> >>                            out.setContent(new
>> >> StringSource(writer.toString
>> >> ()));
>> >>                            exchange.setMessage(out, "out");
>> >>                            send(exchange);
>> >>
>> >>                        } else if (input instanceof Unsubscribe) {
>> >>                            subscription = null;
>> >>                            UnsubscribeResponse response = new
>> >> UnsubscribeResponse();
>> >>                            StringWriter writer = new StringWriter();
>> >>                            jaxbContext.createMarshaller
>> >> ().marshal(response,
>> >> writer);
>> >>                            NormalizedMessage out =
>> exchange.createMessage
>> >> ();
>> >>                            out.setContent(new
>> >> StringSource(writer.toString
>> >> ()));
>> >>                            exchange.setMessage(out, "out");
>> >>                            send(exchange);
>> >>
>> >>
>> >>                        } else {
>> >>                            throw new Exception("Unkown request");
>> >>                        }
>> >>                    } catch (Exception e) {
>> >>                        fail(exchange, e);
>> >>                    }
>> >>                // This is a notification to publish
>> >>                }
>> >>
>> >>                  else {
>> >>                    try {
>> >>                        if (!demand || subscription != null) {
>> >>                            Element elem = new
>> >> SourceTransformer().toDOMElement(exchange.getMessage("in"));
>> >>                            wsnBroker.notify(receiveTopic, elem);
>> >>                            done(exchange);
>> >>                        } else {
>> >>                            log.info("Ingore notification as the
>> publisher
>> >> is no
>> >> subscribers");
>> >>                        }
>> >>                    } catch (Exception e) {
>> >>                        fail(exchange, e);
>> >>                        }
>> >>                }
>> >>            }
>> >>
>> >>  }
>> >>
>> >>  ......
>> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> DEBUG - JMSFlow                        - Called Flow send
>> >> DEBUG - ActiveMQSession                - Sending message:
>> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> messageId
>> >> =
>> >> ID:martina-39597-1199704995676-3:0:1:1:5, originalDestination = null,
>> >> originalTransactionId = null, producerId =
>> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
>> >> queue://org.apache.servicemix.jms.{
>> >>
>> http://servicemix.apache.org/demo}trace:endpoint<http://servicemix.apache.org/demo%7Dtrace:endpoint>
>> <http://servicemix.apache.org/demo%7Dtrace:endpoint>
>> >> ,
>> >> transactionId = null, expiration = 0, timestamp = 1199705011173,
>> arrival
>> >> =
>> >> 0, correlationId = null, replyTo = null, persistent = true, type =
>> null,
>> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
>> null,
>> >> compressed = false, userID = null, content =
>> >> org.apache.activemq.util.ByteSequence@10a69f0, marshalledProperties =
>> >> null,
>> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
>> null,
>> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
>> >> INFO  - SubscriberComponent            - Exchange: InOnly[
>> >>  id: ID:192.168.0.172-11753fdefba-2:0
>> >>  status: Active
>> >>  role: provider
>> >>  endpoint: endpoint
>> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> >> Example
>> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> ] received IN message:
>> >>
>> >>
>> org.apache.servicemix.jbi.messaging.NormalizedMessageImpl@b125bd{properties
>> >> :
>> >> {}}
>> >> INFO  - SubscriberComponent            - Body is: <?xml version="1.0"
>> >> encoding="UTF-8"?><ns2:Notify xmlns:ns2="
>> >> http://docs.oasis-open.org/wsn/b-2"
>> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> >> Example
>> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
>> status
>> =
>> >> getStatus()
>> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
>> >> STATO
>> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> >> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
>> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> DEBUG - JMSFlow                        - Called Flow send
>> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> container.sendExchange(mirror);
>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> DEBUG - ActiveMQSession                - Sending message:
>> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> messageId
>> >> =
>> >> ID:martina-39597-1199704995676-3:0:1:1:6, originalDestination = null,
>> >> originalTransactionId = null, producerId =
>> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
>> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
>> expiration
>> >> =
>> >> 0, timestamp = 1199705011183, arrival = 0, correlationId = null,
>> replyTo
>> >> =
>> >> null, persistent = true, type = null, priority = 4, groupID = null,
>> >> groupSequence = 0, targetConsumerId = null, compressed = false, userID
>> =
>> >> null, content = org.apache.activemq.util.ByteSequence@c70f32,
>> >> marshalledProperties = null, dataStructure = null, redeliveryCounter =
>> 0,
>> >> size = 0, properties = null, readOnlyProperties = true, readOnlyBody =
>> >> true,
>> >> droppable = false}
>> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> container.sendExchange(mirror);
>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
>> InOnly[
>> >>  id: ID:192.168.0.172-11753fdefba-2:0
>> >>  status: Done
>> >>  role: provider
>> >>  endpoint: endpoint
>> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> >> Example
>> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> ]
>> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
>> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
>> status
>> =
>> >> getStatus()
>> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
>> >> STATO
>> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> >> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
>> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> DEBUG - JMSFlow                        - Called Flow send
>> >> DEBUG - WSNSpringComponent             - Received exchange: status:
>> Done,
>> >> role: consumer
>> >> DEBUG - WSNSpringComponent             - Retrieved correlation id:
>> null
>> >> DEBUG - ActiveMQSession                - Sending message:
>> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> messageId
>> >> =
>> >> ID:martina-39597-1199704995676-3:0:1:1:7, originalDestination = null,
>> >> originalTransactionId = null, producerId =
>> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
>> >> queue://org.apache.servicemix.jms.{
>> >>
>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> ,
>> >> transactionId = null, expiration = 0, timestamp = 1199705011188,
>> arrival
>> >> =
>> >> 0, correlationId = null, replyTo = null, persistent = true, type =
>> null,
>> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
>> null,
>> >> compressed = false, userID = null, content =
>> >> org.apache.activemq.util.ByteSequence@1c8f59c, marshalledProperties =
>> >> null,
>> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
>> null,
>> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
>> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> container.sendExchange(mirror);
>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> ERROR - JMSFlow                        - Caught an exception routing
>> >> ExchangePacket:
>> >> javax.jbi.messaging.MessagingException: illegal call to send /
>> sendSync
>> >>        at
>> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> >> MessageExchangeImpl.java:581)
>> >>        at
>> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>> >> DeliveryChannelImpl.java:384)
>> >>        at
>> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> >> DeliveryChannelImpl.java:444)
>> >>        at
>> >>
>> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
>> >> :249)
>> >>        at
>> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> >> SubscriberComponent.java:203)
>> >>        at
>> >>
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> >> DeliveryChannelImpl.java:621)
>> >>        at
>> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> >> AbstractFlow.java:174)
>> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
>> >> JMSFlow.java:1)
>> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>> >> JMSFlow.java:543)
>> >>        at
>> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> >> (ThreadPoolExecutor.java:665)
>> >>        at
>> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> >> (ThreadPoolExecutor.java:690)
>> >>        at java.lang.Thread.run(Thread.java:595)
>> >>
>> >> Can you help me again?
>> >> Thanks in advance!
>> >>
>> >> Martina
>> >>
>> >>
>> >>
>> >> gnodet wrote:
>> >> >
>> >> > You need to use an InOnly or RobustInOnly exchange, not an InOut
>> >> exchange,
>> >> > as notifications do not have any out messages.
>> >> >
>> >> > On Jan 4, 2008 5:16 PM, martymusk <ma...@email.it> wrote:
>> >> >
>> >> >>
>> >> >> Thus , I've created a new class "SubscriberComponent" that is a
>> copy
>> >> of
>> >> >> PublisherComponent. Trhough it instance2 receive exchange and try
>> to
>> >> send
>> >> >> scambio (copy of exchange). When I run example the following error
>> >> >> occurs...
>> >> >>
>> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> >> messageId
>> >> >> =
>> >> >> ID:martina-38529-1199462112612-3:0:1:1:6, originalDestination =
>> null,
>> >> >> originalTransactionId = null, producerId =
>> >> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
>> >> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
>> >> expiration
>> >> >> =
>> >> >> 0, timestamp = 1199462153935, arrival = 0, correlationId = null,
>> >> replyTo
>> >> >> =
>> >> >> null, persistent = true, type = null, priority = 4, groupID = null,
>> >> >> groupSequence = 0, targetConsumerId = null, compressed = false,
>> userID
>> >> =
>> >> >> null, content = org.apache.activemq.util.ByteSequence@b2175,
>> >> >> marshalledProperties = null, dataStructure = null,
>> redeliveryCounter
>> =
>> >> 0,
>> >> >> size = 0, properties = null, readOnlyProperties = true,
>> readOnlyBody
>> =
>> >> >> true,
>> >> >> droppable = false}
>> >> >> DEBUG - WSNSpringComponent             - Received exchange: status:
>> >> >> Active,
>> >> >> role: consumer
>> >> >> DEBUG - WSNSpringComponent             - Retrieved correlation id:
>> >> null
>> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> container.sendExchange(mirror);
>> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> >> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> >> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
>> >> InOut[
>> >> >>  id: ID:192.168.0.172-1174583cdf9-2:0
>> >> >>  status: Active
>> >> >>  role: provider
>> >> >>  endpoint: endpoint
>> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >> >>
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> >> >> Example
>> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> >> >> Job</fullname><description/><fireTime>Fri Jan 04 16:55:53 CET
>> >> >>
>> >> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> >> ]
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
>> >> status
>> >> =
>> >> >> getStatus()
>> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA
>> LO
>> >> >> STATO
>> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> me.handleSend(sync)
>> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> >> DEBUG - JMSFlow                        - Called Flow send
>> >> >> DEBUG - ActiveMQSession                - Sending message:
>> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> >> messageId
>> >> >> =
>> >> >> ID:martina-38529-1199462112612-3:0:1:1:7, originalDestination =
>> null,
>> >> >> originalTransactionId = null, producerId =
>> >> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
>> >> >> queue://org.apache.servicemix.jms.{
>> >> >>
>> >>
>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> >> ,
>> >> >> transactionId = null, expiration = 0, timestamp = 1199462153952,
>> >> arrival
>> >> >> =
>> >> >> 0, correlationId = null, replyTo = null, persistent = true, type =
>> >> null,
>> >> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
>> >> null,
>> >> >> compressed = false, userID = null, content =
>> >> >> org.apache.activemq.util.ByteSequence@779b3e, marshalledProperties
>> =
>> >> >> null,
>> >> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
>> >> null,
>> >> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
>> >> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> >> container.sendExchange(mirror);
>> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> >> ERROR - JMSFlow                        - Caught an exception
>> routing
>> >> >> ExchangePacket:
>> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
>> >> sendSync
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> >> >> MessageExchangeImpl.java:581)
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>> >> >> DeliveryChannelImpl.java:384)
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> >> >> DeliveryChannelImpl.java:444)
>> >> >>        at
>> >> >>
>> >>
>> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
>> >> >> :249)
>> >> >>        at
>> >> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> >> >> SubscriberComponent.java:203)
>> >> >>        at
>> >> >>
>> >>
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> >> >> DeliveryChannelImpl.java:621)
>> >> >>        at
>> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> >> >> AbstractFlow.java:174)
>> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
>> >> >> JMSFlow.java:1)
>> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>> >> >> JMSFlow.java:543)
>> >> >>        at
>> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> >> >> (ThreadPoolExecutor.java:665)
>> >> >>        at
>> >> >>
>> >> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> >> >> (ThreadPoolExecutor.java:690)
>> >> >>        at java.lang.Thread.run(Thread.java:595)
>> >> >>
>> >> >> I do wrong again?
>> >> >>
>> >> >> Thank you!!!
>> >> >> Martina
>> >> >>
>> >> >>
>> >> >> gnodet wrote:
>> >> >> >
>> >> >> > You should have a look at the existing code:
>> >> >> >
>> >> >> >
>> >> >>
>> >>
>> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/spring/PublisherComponent.java?r=602828
>> >> >> >
>> >> >> > Note that the publisher component actually use the client api
>> (line
>> >> >> 172).
>> >> >> > For details on thow the client api works (which is how to send a
>> JBI
>> >> >> > exchange to the WSN broker), see:
>> >> >> >
>> >> >> >
>> >> >>
>> >>
>> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/client/NotificationBroker.java?r=602828#l89
>> >> >> >
>> >> >> > I would advise you to start from the publisher component, copy it
>> >> and
>> >> >> use
>> >> >> > it
>> >> >> > instead of your TraceComponent.
>> >> >> > Each time it receives a JBI exchange, it will publish it through
>> the
>> >> >> > WSNotification broker.
>> >> >> >
>> >> >> > Also look at the various resources on the web site that may help
>> >> you:
>> >> >> >   http://servicemix.apache.org/servicemix-wsn2005.html
>> >> >> >   http://servicemix.apache.org/example-scenario.html
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > On Jan 4, 2008 2:58 PM, martymusk <ma...@email.it> wrote:
>> >> >> >
>> >> >> >>
>> >> >> >> Hy gnodet and thank you very much for your helpfulness,
>> >> >> >> but I don't understand exactly what I must to do.
>> >> >> >>
>> >> >> >> How can I send JBI exchange to the WSN broker directly?
>> >> >> >> How can I use WSN client api.
>> >> >> >>
>> >> >> >> I'm working for a thesis at University of Naples.
>> >> >> >> My purpose is to study WSN performance.
>> >> >> >> I've found your WSN implementation very useful for me, but to
>> study
>> >> >> >> performance, I need exchange was send back.
>> >> >> >> It is more than a mounth I'm triyng to do this.
>> >> >> >>
>> >> >> >> I would be very grateful if you can help me. Otherwise, there
>> are
>> >> no
>> >> >> >> problems, I'll keep on study over and over again, hoping I be
>> able
>> >> to
>> >> >> >> achieve my purpose.
>> >> >> >>
>> >> >> >> Thank you very much.
>> >> >> >> Martina
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> gnodet wrote:
>> >> >> >> >
>> >> >> >> > I thought I pointed you to the right direction.
>> >> >> >> > Do not use the PublisherComponent that way: either use it as
>> it
>> >> is
>> >> >> >> > intended
>> >> >> >> > (deploy it as a component onto the lightweight container) or
>> use
>> >> the
>> >> >> >> WSN
>> >> >> >> > client api:
>> >> >> >> >    wsn.notify(topic, msg)
>> >> >> >> >
>> >> >> >> > I'm not sure what you are trying to achieve with your
>> >> >> TraceComponent.
>> >> >> >>  It
>> >> >> >> > sounds like you want to reimplement the PublisherComponent. 
>> If
>> >> so,
>> >> >> you
>> >> >> >> > should have a look at how it is implemented and patch it.
>> >> >> >> >
>> >> >> >> > Also note that both PublisherComponent and the WSN client api
>> are
>> >> >> just
>> >> >> >> > sugar, you can send a JBI exchange to the WSN broker directly
>> if
>> >> you
>> >> >> >> want.
>> >> >> >> >
>> >> >> >> > On Jan 4, 2008 2:13 PM, martymusk <ma...@email.it> wrote:
>> >> >> >> >
>> >> >> >> >>
>> >> >> >> >> My problem is always the same!
>> >> >> >> >> In wsn-example, after Consumer received an exchange, I'd like
>> it
>> >> >> send
>> >> >> >> >> copy
>> >> >> >> >> of it. But it doesn't happen. :-(
>> >> >> >> >> I've modified TraceComponent class in the following way, but
>> it
>> >> >> >> doesn't
>> >> >> >> >> work
>> >> >> >> >> fine:
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> package org.apache.servicemix.wsn;
>> >> >> >> >>
>> >> >> >> >> import java.io.StringWriter;
>> >> >> >> >>
>> >> >> >> >> import javax.jbi.JBIException;
>> >> >> >> >> import javax.jbi.messaging.ExchangeStatus;
>> >> >> >> >> import javax.jbi.messaging.MessageExchange;
>> >> >> >> >> import javax.jbi.messaging.MessagingException;
>> >> >> >> >> import javax.jbi.messaging.NormalizedMessage;
>> >> >> >> >> import javax.xml.bind.JAXBContext;
>> >> >> >> >> import javax.xml.transform.Source;
>> >> >> >> >> import javax.xml.transform.TransformerException;
>> >> >> >> >> //import javax.jbi.messaging.InOut;
>> >> >> >> >>
>> >> >> >> >> import
>> org.apache.servicemix.jbi.messaging.MessageExchangeImpl
>> ;
>> >> >> >> >> import org.apache.servicemix.jbi.messaging.InOutImpl;
>> >> >> >> >> import org.apache.commons.logging.Log;
>> >> >> >> >> import org.apache.commons.logging.LogFactory;
>> >> >> >> >> import org.apache.servicemix.MessageExchangeListener;
>> >> >> >> >> import
>> org.apache.servicemix.components.util.ComponentSupport;
>> >> >> >> >> import org.apache.servicemix.wsn.spring.PublisherComponent;
>> >> >> >> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
>> >> >> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
>> >> >> >> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
>> >> >> >> >> import org.apache.servicemix.wsn.client.NotificationBroker;
>> >> >> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
>> >> >> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
>> >> >> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
>> >> >> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
>> >> >> >> >> import org.w3c.dom.Element;
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> public class TraceComponent extends ComponentSupport
>> implements
>> >> >> >> >>                MessageExchangeListener {
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>        private Log log =
>> >> LogFactory.getLog(TraceComponent.class);
>> >> >> >> >>
>> >> >> >> >>        private SourceTransformer sourceTransformer = new
>> >> >> >> >> SourceTransformer();
>> >> >> >> >>
>> >> >> >> >>        public Log getLog() {
>> >> >> >> >>                return log;
>> >> >> >> >>        }
>> >> >> >> >>
>> >> >> >> >>        public void setLog(Log log) {
>> >> >> >> >>                this.log = log;
>> >> >> >> >>        }
>> >> >> >> >>
>> >> >> >> >>        public SourceTransformer getSourceTransformer() {
>> >> >> >> >>                return sourceTransformer;
>> >> >> >> >>        }
>> >> >> >> >>
>> >> >> >> >>        public void setSourceTransformer(SourceTransformer
>> >> >> >> >> sourceTransformer) {
>> >> >> >> >>                this.sourceTransformer = sourceTransformer;
>> >> >> >> >>        }
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>        //AGGIUNGO CODICE
>> >> >> >> >>
>> >> >> >> >>        PublisherComponent publisher = new
>> PublisherComponent();
>> >> >> >> >>          private String subscriptionEndpoint =
>> "subscription";
>> >> >> >> >>          private NotificationBroker wsnBroker;
>> >> >> >> >>          private String topic;
>> >> >> >> >>          private String msg;
>> >> >> >> >>          private boolean demand;
>> >> >> >> >>          private Subscribe subscription;
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>          public String getTopic() {
>> >> >> >> >>                return topic;
>> >> >> >> >>            }
>> >> >> >> >>
>> >> >> >> >>            /**
>> >> >> >> >>             * @param topic The topic to set.
>> >> >> >> >>             */
>> >> >> >> >>            public void setTopic(String topic) {
>> >> >> >> >>               this.topic = topic;
>> >> >> >> >>            }
>> >> >> >> >>
>> >> >> >> >>         public void init() throws JBIException {
>> >> >> >> >>                super.init();
>> >> >> >> >>                getContext().activateEndpoint(getService(),
>> >> >> >> >> subscriptionEndpoint);
>> >> >> >> >>                 log.info("METODO INIT");
>> >> >> >> >>                // publisher.init();
>> >> >> >> >>
>> >> >> >> >>                 publisher.setTopic(topic);
>> >> >> >> >>            }
>> >> >> >> >>
>> >> >> >> >>            /* (non-Javadoc)
>> >> >> >> >>             * @see
>> javax.jbi.management.LifeCycleMBean#start()
>> >> >> >> >>             */
>> >> >> >> >>            public void start() throws JBIException {
>> >> >> >> >>
>> >> >> >> >>                log.info("METODO START");
>> >> >> >> >>                //publisher.start();
>> >> >> >> >>                new Thread() {
>> >> >> >> >>                  public void run() {
>> >> >> >> >>                       try {
>> >> >> >> >>                           wsnBroker = new
>> >> >> >> >> NotificationBroker(getContext());
>> >> >> >> >>
>> >> >> >> >>                           String wsaAddress =
>> >> >> >> >> getService().getNamespaceURI() + "/"
>> >> >> >> >> + getService().getLocalPart() + "/" + subscriptionEndpoint;
>> >> >> >> >>
>> >> >> >> >>
>> >> >>
>> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
>> >> >> >> >>                                                       topic,
>> >> >> >> >>
>>  demand);
>> >> >> >> >>                        } catch (Exception e) {
>> >> >> >> >>                            log.error("Could not create wsn
>> >> client",
>> >> >> >> e);
>> >> >> >> >>                        }
>> >> >> >> >>                    }
>> >> >> >> >>                }.start();
>> >> >> >> >>            }
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>            public void shutDown() throws JBIException {
>> >> >> >> >>                log.info("METODO SHUTDOWN");
>> >> >> >> >>            //  publisher.shutDown();
>> >> >> >> >>               super.shutDown();
>> >> >> >> >>            }
>> >> >> >> >>
>> >> >> >> >>            //FINE CODICE AGGIUNTO
>> >> >> >> >>
>> >> >> >> >>        public void onMessageExchange(MessageExchange
>> exchange)
>> >> >> >> >>                        throws MessagingException {
>> >> >> >> >>                // lets dump the incoming message
>> >> >> >> >>                NormalizedMessage message =
>> exchange.getMessage
>> >> >> ("in");
>> >> >> >> >>                if (message == null) {
>> >> >> >> >>                        log.warn("Received null message from
>> >> >> exchange:
>> >> >> >> "
>> >> >> >> +
>> >> >> >> >> exchange);
>> >> >> >> >>                } else {
>> >> >> >> >>                        log.info("Exchange: " + exchange + "
>> >> >> received
>> >> >> >> IN
>> >> >> >> >> message: "
>> >> >> >> >>                                        + message);
>> >> >> >> >>                        try {
>> >> >> >> >>                                log.info("Body is: "
>> >> >> >> >>                                                +
>> >> >> >> >> sourceTransformer.toString(message.getContent()));
>> >> >> >> >>                        } catch (TransformerException e) {
>> >> >> >> >>                                log.error("Failed to turn
>> message
>> >> >> body
>> >> >> >> >> into
>> >> >> >> >> text: " + e, e);
>> >> >> >> >>                        }
>> >> >> >> >>                }
>> >> >> >> >>                done(exchange);
>> >> >> >> >>                log.info("MESSAGGIO RICEVUTO");
>> >> >> >> >>
>> >> >> >> >>                log.info("COPIO IL PACCHETTO");
>> >> >> >> >>
>> >> >> >> >>                MessageExchange scambio =
>> >> (MessageExchange)exchange;
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>                log.info("INVIO");
>> >> >> >> >>
>> >> >> >> >>          try{
>> >> >> >> >>
>> >> >> >> >>                log.info("FASE INVIO");
>> >> >> >> >>                //publisher.onMessageExchange(scambio);
>> >> >> >> >>
>> >> >> >> >>                //AGGIUNGO onMessageExchange
>> >> >> >> >>
>> >> >> >> >>                if (exchange.getStatus() !=
>> >> ExchangeStatus.ACTIVE)
>> >> {
>> >> >> >> >>                    return;
>> >> >> >> >>                }
>> >> >> >> >>                // This is a notification from the WSN broker
>> >> >> >> >>                if
>> >> >> >> >>
>> >> >> >>
>> >> >>
>> >>
>> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
>> >> >> >> {
>> >> >> >> >>                    try {
>> >> >> >> >>                        JAXBContext jaxbContext =
>> >> >> >> >> JAXBContext.newInstance(Subscribe.class);
>> >> >> >> >>                        Source src = exchange.getMessage
>> >> >> >> >> ("in").getContent();
>> >> >> >> >>                        Object input =
>> >> >> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
>> >> >> >> >>                        if (input instanceof Subscribe) {
>> >> >> >> >>                            subscription = (Subscribe) input;
>> >> >> >> >>                            SubscribeResponse response = new
>> >> >> >> >> SubscribeResponse();
>> >> >> >> >>                            String wsaAddress =
>> >> >> >> >> getService().getNamespaceURI() +
>> >> >> >> >> "/" + getService().getLocalPart() + "/" +
>> subscriptionEndpoint;
>> >> >> >> >>
>> >> >> >> >> response.setSubscriptionReference(AbstractWSAClient.createWSA
>> >> >> >> >> (wsaAddress));
>> >> >> >> >>                            StringWriter writer = new
>> >> >> StringWriter();
>> >> >> >> >>                            jaxbContext.createMarshaller
>> >> >> >> >> ().marshal(response,
>> >> >> >> >> writer);
>> >> >> >> >>                            NormalizedMessage out =
>> >> >> >> exchange.createMessage
>> >> >> >> >> ();
>> >> >> >> >>                            out.setContent(new
>> >> >> >> >> StringSource(writer.toString
>> >> >> >> >> ()));
>> >> >> >> >>                            exchange.setMessage(out, "out");
>> >> >> >> >>                            send(exchange);
>> >> >> >> >>
>> >> >> >> >>                        } else if (input instanceof
>> Unsubscribe)
>> >> {
>> >> >> >> >>                            subscription = null;
>> >> >> >> >>                            UnsubscribeResponse response = new
>> >> >> >> >> UnsubscribeResponse();
>> >> >> >> >>                            StringWriter writer = new
>> >> >> StringWriter();
>> >> >> >> >>                            jaxbContext.createMarshaller
>> >> >> >> >> ().marshal(response,
>> >> >> >> >> writer);
>> >> >> >> >>                            NormalizedMessage out =
>> >> >> >> exchange.createMessage
>> >> >> >> >> ();
>> >> >> >> >>                            out.setContent(new
>> >> >> >> >> StringSource(writer.toString
>> >> >> >> >> ()));
>> >> >> >> >>                            exchange.setMessage(out, "out");
>> >> >> >> >>                            send(exchange);
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>                        } else {
>> >> >> >> >>                            throw new Exception("Unkown
>> >> request");
>> >> >> >> >>                        }
>> >> >> >> >>                    } catch (Exception e) {
>> >> >> >> >>                        fail(exchange, e);
>> >> >> >> >>                    }
>> >> >> >> >>                // This is a notification to publish
>> >> >> >> >>                }
>> >> >> >> >>
>> >> >> >> >>                  else {
>> >> >> >> >>                    try {
>> >> >> >> >>
>> >> >> >> >>                    log.info("SALTA");
>> >> >> >> >>                        if (!demand || subscription != null) {
>> >> >> >> >>                                log.info("ENTRO NELL'IF");
>> >> >> >> >>                           // Element elem = new
>> >> >> >> >> SourceTransformer().toDOMElement(exchange.getMessage("in"));
>> >> >> >> >>                            log.info("PRIMA DI WSNBROKER");
>> >> >> >> >>                            wsnBroker.notify(topic, msg);
>> >> >> >> >>                            log.info("PRIMA DI DONE");
>> >> >> >> >>
>>  getDeliveryChannel().send(exchange);
>> >> >> >> >>                            log.info("DOPO DI DONE");
>> >> >> >> >>                        } else {
>> >> >> >> >>                            log.info("Ingore notification as
>> the
>> >> >> >> publisher
>> >> >> >> >> is no
>> >> >> >> >> subscribers");
>> >> >> >> >>                        }
>> >> >> >> >>                    } catch (Exception e) {
>> >> >> >> >>                        fail(exchange, e);
>> >> >> >> >>                        }
>> >> >> >> >>
>> >> >> >> >>                log.debug("IL PACCHETTO INVIATO E': " +
>> scambio);
>> >> >> >> >>
>> >> >> >> >>                  }
>> >> >> >> >>                //FINE onMessageExchange
>> >> >> >> >>
>> >> >> >> >>           } catch(JBIException e){
>> >> >> >> >>                  log.error("ECCEZIONE GENERATA!");
>> >> >> >> >>          }
>> >> >> >> >>
>> >> >> >> >>      log.info("INVIATO");
>> >> >> >> >> }
>> >> >> >> >> }
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> Help me if you can.
>> >> >> >> >> Thank you very much for your helpfulness...
>> >> >> >> >>
>> >> >> >> >> Martina
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >> gnodet wrote:
>> >> >> >> >> >
>> >> >> >> >> > You should not have to deal nor see the internal state of
>> the
>> >> >> >> exchange.
>> >> >> >> >> > If guess you have an exception when trying to send an
>> >> exchange,
>> >> >> but
>> >> >> >> >> this
>> >> >> >> >> > means that there is a problem in your code.  You should
>> post
>> a
>> >> >> >> snippet
>> >> >> >> >> of
>> >> >> >> >> > your code that is failing so that we can help you.
>> >> >> >> >> >
>> >> >> >> >> > On Jan 4, 2008 12:22 PM, martymusk <ma...@email.it>
>> wrote:
>> >> >> >> >> >
>> >> >> >> >> >>
>> >> >> >> >> >> Hy,
>> >> >> >> >> >> I've a question...
>> >> >> >> >> >> can I set anywhere Consumer to CAN_SEND?
>> >> >> >> >> >>
>> >> >> >> >> >> I hope you can help me.
>> >> >> >> >> >> Thank you in advance.
>> >> >> >> >> >>
>> >> >> >> >> >> Martina
>> >> >> >> >> >> --
>> >> >> >> >> >> View this message in context:
>> >> >> >> >> >>
>> >> >> >>
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
>> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> >> >> Nabble.com.
>> >> >> >> >> >>
>> >> >> >> >> >>
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > --
>> >> >> >> >> > Cheers,
>> >> >> >> >> > Guillaume Nodet
>> >> >> >> >> > ------------------------
>> >> >> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >>
>> >> >> >> >> --
>> >> >> >> >> View this message in context:
>> >> >> >> >>
>> >> >>
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616107.html
>> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> >> Nabble.com.
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > --
>> >> >> >> > Cheers,
>> >> >> >> > Guillaume Nodet
>> >> >> >> > ------------------------
>> >> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >> --
>> >> >> >> View this message in context:
>> >> >> >>
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616748.html
>> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> Nabble.com.
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > Cheers,
>> >> >> > Guillaume Nodet
>> >> >> > ------------------------
>> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14619757.html
>> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > Cheers,
>> >> > Guillaume Nodet
>> >> > ------------------------
>> >> > Blog: http://gnodet.blogspot.com/
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14663812.html
>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> > Cheers,
>> > Guillaume Nodet
>> > ------------------------
>> > Blog: http://gnodet.blogspot.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14664874.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14665988.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Consumer Can Send

Posted by Guillaume Nodet <gn...@gmail.com>.
Have you tried with the original code before modifying the class from
ServiceMix ?
The first lines of the SubscriberComponent#onMessageExchange are

 if (exchange.getStatus() != ExchangeStatus.ACTIVE) {
     return;
 }

This is because you have to ignore exchanges in an Error / Done status.
>From the code you pasted, it seems you removed those lines and instead do
some copy work and call done() which will fail for exchanges that are not
active.

You can add debugging statements if you need (debug remoting works fine
too), but please try with the original code first.

On Jan 7, 2008 1:52 PM, martymusk <ma...@email.it> wrote:

>
> Thank you very much...
> The exception is the same, I post it:
>
> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E': InOnly[
>  id: ID:192.168.0.172-11754495367-2:0
>  status: Done
>  role: provider
>  endpoint: endpoint
>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> xmlns="http://www.w3.org/2005/08/addressing"
> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My Example
> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> Job</fullname><description/><fireTime>Mon Jan 07 13:46:56 CET
>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> ]
> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus status =
> getStatus()
> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
> STATO
> INFO  - MessageExchangeImpl            - TERMINA handleSend
> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
> INFO  - DeliveryChannelImpl            - DOPO DI
> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> DEBUG - JMSFlow                        - Called Flow send
> DEBUG - ActiveMQSession                - Sending message:
> ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId
> =
> ID:martina-39867-1199709997721-3:0:1:1:7, originalDestination = null,
> originalTransactionId = null, producerId =
> ID:martina-39867-1199709997721-3:0:1:1, destination =
> queue://org.apache.servicemix.jms.{
> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> ,
> transactionId = null, expiration = 0, timestamp = 1199710016807, arrival =
> 0, correlationId = null, replyTo = null, persistent = true, type = null,
> priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
> compressed = false, userID = null, content =
> org.apache.activemq.util.ByteSequence@5ac5f, marshalledProperties = null,
> dataStructure = null, redeliveryCounter = 0, size = 0, properties = null,
> readOnlyProperties = true, readOnlyBody = true, droppable = false}
> INFO  - DeliveryChannelImpl            - DOPO
> container.sendExchange(mirror);
> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> ERROR - JMSFlow                        - Caught an exception routing
> ExchangePacket:
> javax.jbi.messaging.MessagingException: illegal call to send / sendSync
>        at
> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> MessageExchangeImpl.java:581)
>        at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> DeliveryChannelImpl.java:384)
>        at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> DeliveryChannelImpl.java:444)
>        at
> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
> :249)
>        at
> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> SubscriberComponent.java:204)
>        at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> DeliveryChannelImpl.java:621)
>        at
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> AbstractFlow.java:174)
>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
> JMSFlow.java:1)
>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
> JMSFlow.java:543)
>        at
>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> (ThreadPoolExecutor.java:665)
>        at
>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> (ThreadPoolExecutor.java:690)
>        at java.lang.Thread.run(Thread.java:595)
> javax.jbi.messaging.MessagingException: illegal call to send / sendSync
>        at
> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> MessageExchangeImpl.java:581)
>        at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> DeliveryChannelImpl.java:384)
>        at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> DeliveryChannelImpl.java:444)
>        at
> org.apache.servicemix.components.util.PojoSupport.done(PojoSupport.java
> :193)
>        at
> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> SubscriberComponent.java:198)
>        at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> DeliveryChannelImpl.java:621)
>        at
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> AbstractFlow.java:174)
>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
> JMSFlow.java:1)
>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
> JMSFlow.java:543)
>        at
>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> (ThreadPoolExecutor.java:665)
>        at
>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> (ThreadPoolExecutor.java:690)
>        at java.lang.Thread.run(Thread.java:595)
>
> What do I do wrong?
> Thanks in advance!
>
> Martina
>
>
> gnodet wrote:
> >
> > Just before calling fail(exchange, e), could you display the stack trace
> > of
> > the exception ?
> >    e.printStackTrace()
> > and send this error ?
> > This is the real error, but it seems to be hidden by fail() throwing
> > another
> > excepiton.
> >
> > On Jan 7, 2008 12:32 PM, martymusk <ma...@email.it> wrote:
> >
> >>
> >> Hy gnodet,
> >> thank you for your felpfulness.
> >> Thus, I've used InOnly exchange, but I've the same error.
> >> I post you my class and the error.
> >>
> >> package org.apache.servicemix.wsn;
> >>
> >>
> >> import java.io.StringWriter;
> >>
> >> import javax.jbi.JBIException;
> >> import javax.jbi.messaging.ExchangeStatus;
> >> import javax.jbi.messaging.MessageExchange;
> >> import javax.jbi.messaging.MessagingException;
> >> import javax.jbi.messaging.NormalizedMessage;
> >> import javax.xml.bind.JAXBContext;
> >> import javax.xml.transform.Source;
> >> import javax.xml.transform.TransformerException;
> >>
> >> import org.apache.commons.logging.Log;
> >> import org.apache.commons.logging.LogFactory;
> >> import org.apache.servicemix.MessageExchangeListener;
> >> import org.apache.servicemix.components.util.ComponentSupport;
> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
> >> import org.apache.servicemix.jbi.jaxp.StringSource;
> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
> >> import org.apache.servicemix.wsn.client.NotificationBroker;
> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
> >> import org.w3c.dom.Element;
> >>
> >>
> >>
> >>
> >>
> >>
> >>  public class SubscriberComponent extends ComponentSupport implements
> >> MessageExchangeListener {
> >>
> >>            private static final Log log =
> >> LogFactory.getLog(SubscriberComponent.class);
> >>
> >>            private NotificationBroker wsnBroker;
> >>            private String receiveTopic;
> >>            private boolean demand;
> >>            private String subscriptionEndpoint = "subscription";
> >>            private Subscribe subscription;
> >>
> >>            /**
> >>             * @return Returns the demand.
> >>             */
> >>            public boolean getDemand() {
> >>                return demand;
> >>            }
> >>
> >>            /**
> >>             * @param demand The demand to set.
> >>             */
> >>            public void setDemand(boolean demand) {
> >>                this.demand = demand;
> >>            }
> >>
> >>            /**
> >>             * @return Returns the topic.
> >>             */
> >>            public String getTopic() {
> >>                return receiveTopic;
> >>            }
> >>
> >>            /**
> >>             * @param topic The topic to set.
> >>             */
> >>            public void setTopic(String receiveTopic) {
> >>                this.receiveTopic = receiveTopic;
> >>            }
> >>
> >>            /**
> >>             * @return Returns the subscription.
> >>             */
> >>            public Subscribe getSubscription() {
> >>                return subscription;
> >>            }
> >>
> >>            /* (non-Javadoc)
> >>             * @see
> >> org.apache.servicemix.jbi.management.BaseLifeCycle#init
> >> ()
> >>             */
> >>            public void init() throws JBIException {
> >>                super.init();
> >>                getContext().activateEndpoint(getService(),
> >> subscriptionEndpoint);
> >>            }
> >>
> >>            /* (non-Javadoc)
> >>             * @see javax.jbi.management.LifeCycleMBean#start()
> >>             */
> >>            public void start() throws JBIException {
> >>                new Thread() {
> >>                    public void run() {
> >>                        try {
> >>                            wsnBroker = new
> >> NotificationBroker(getContext());
> >>                            String wsaAddress =
> >> getService().getNamespaceURI() +
> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
> >>
> >> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
> >>                                                        receiveTopic,
> >>                                                        demand);
> >>                        } catch (Exception e) {
> >>                            log.error("Could not create wsn client", e);
> >>                        }
> >>                    }
> >>                }.start();
> >>            }
> >>
> >>
> >>            private SourceTransformer sourceTransformer = new
> >> SourceTransformer();
> >>
> >>            public SourceTransformer getSourceTransformer() {
> >>                        return sourceTransformer;
> >>                }
> >>
> >>                public void setSourceTransformer(SourceTransformer
> >> sourceTransformer) {
> >>                        this.sourceTransformer = sourceTransformer;
> >>                }
> >>
> >>            /* (non-Javadoc)
> >>             * @see javax.jbi.management.LifeCycleMBean#shutDown()
> >>             */
> >>            public void shutDown() throws JBIException {
> >>                super.shutDown();
> >>            }
> >>
> >>            /* (non-Javadoc)
> >>             * @see
> >> org.apache.servicemix.MessageExchangeListener#onMessageExchange(
> >> javax.jbi.messaging.MessageExchange)
> >>             */
> >>            public void onMessageExchange(MessageExchange exchange)
> throws
> >> MessagingException {
> >>
> >>                NormalizedMessage message = exchange.getMessage("in");
> >>                        if (message == null) {
> >>                                log.warn("Received null message from
> >> exchange: " + exchange);
> >>                        } else {
> >>                                log.info("Exchange: " + exchange + "
> >> received IN message: "
> >>                                                + message);
> >>                                try {
> >>                                        log.info("Body is: "
> >>                                                        +
> >> sourceTransformer.toString(message.getContent()));
> >>                                } catch (TransformerException e) {
> >>                                        log.error("Failed to turn
> message
> >> body into text: " + e, e);
> >>                                }
> >>                        }
> >>                        done(exchange);
> >>                        log.info("MESSAGGIO RICEVUTO");
> >>
> >>                  log.info("COPIO IL PACCHETTO");
> >>
> >>                        MessageExchange scambio =
> >> (MessageExchange)exchange;
> >>                        log.info("IL PACCHETTO COPIATO E': " +scambio);
> >>
> >>
> >>                if (exchange.getStatus() != ExchangeStatus.DONE) {
> >>                        log.info("RITORNA PERCHE' LO STATO E': "
> >> +exchange.getStatus());
> >>                    return;
> >>                }
> >>                // This is a notification from the WSN broker
> >>                if
> >> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
> {
> >>                    try {
> >>                        JAXBContext jaxbContext =
> >> JAXBContext.newInstance(Subscribe.class);
> >>                        Source src = exchange.getMessage
> >> ("in").getContent();
> >>                        Object input =
> >> jaxbContext.createUnmarshaller().unmarshal(src);
> >>                        if (input instanceof Subscribe) {
> >>                            subscription = (Subscribe) input;
> >>                            SubscribeResponse response = new
> >> SubscribeResponse();
> >>                            String wsaAddress =
> >> getService().getNamespaceURI() +
> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
> >>
> >> response.setSubscriptionReference(AbstractWSAClient.createWSA
> >> (wsaAddress));
> >>                            StringWriter writer = new StringWriter();
> >>                            jaxbContext.createMarshaller
> >> ().marshal(response,
> >> writer);
> >>                            NormalizedMessage out =
> exchange.createMessage
> >> ();
> >>                            out.setContent(new
> >> StringSource(writer.toString
> >> ()));
> >>                            exchange.setMessage(out, "out");
> >>                            send(exchange);
> >>
> >>                        } else if (input instanceof Unsubscribe) {
> >>                            subscription = null;
> >>                            UnsubscribeResponse response = new
> >> UnsubscribeResponse();
> >>                            StringWriter writer = new StringWriter();
> >>                            jaxbContext.createMarshaller
> >> ().marshal(response,
> >> writer);
> >>                            NormalizedMessage out =
> exchange.createMessage
> >> ();
> >>                            out.setContent(new
> >> StringSource(writer.toString
> >> ()));
> >>                            exchange.setMessage(out, "out");
> >>                            send(exchange);
> >>
> >>
> >>                        } else {
> >>                            throw new Exception("Unkown request");
> >>                        }
> >>                    } catch (Exception e) {
> >>                        fail(exchange, e);
> >>                    }
> >>                // This is a notification to publish
> >>                }
> >>
> >>                  else {
> >>                    try {
> >>                        if (!demand || subscription != null) {
> >>                            Element elem = new
> >> SourceTransformer().toDOMElement(exchange.getMessage("in"));
> >>                            wsnBroker.notify(receiveTopic, elem);
> >>                            done(exchange);
> >>                        } else {
> >>                            log.info("Ingore notification as the
> publisher
> >> is no
> >> subscribers");
> >>                        }
> >>                    } catch (Exception e) {
> >>                        fail(exchange, e);
> >>                        }
> >>                }
> >>            }
> >>
> >>  }
> >>
> >>  ......
> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >> DEBUG - JMSFlow                        - Called Flow send
> >> DEBUG - ActiveMQSession                - Sending message:
> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> messageId
> >> =
> >> ID:martina-39597-1199704995676-3:0:1:1:5, originalDestination = null,
> >> originalTransactionId = null, producerId =
> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
> >> queue://org.apache.servicemix.jms.{
> >> http://servicemix.apache.org/demo}trace:endpoint<http://servicemix.apache.org/demo%7Dtrace:endpoint>
> <http://servicemix.apache.org/demo%7Dtrace:endpoint>
> >> ,
> >> transactionId = null, expiration = 0, timestamp = 1199705011173,
> arrival
> >> =
> >> 0, correlationId = null, replyTo = null, persistent = true, type =
> null,
> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
> null,
> >> compressed = false, userID = null, content =
> >> org.apache.activemq.util.ByteSequence@10a69f0, marshalledProperties =
> >> null,
> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
> null,
> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
> >> INFO  - SubscriberComponent            - Exchange: InOnly[
> >>  id: ID:192.168.0.172-11753fdefba-2:0
> >>  status: Active
> >>  role: provider
> >>  endpoint: endpoint
> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
> >> Example
> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> ] received IN message:
> >>
> >>
> org.apache.servicemix.jbi.messaging.NormalizedMessageImpl@b125bd{properties
> >> :
> >> {}}
> >> INFO  - SubscriberComponent            - Body is: <?xml version="1.0"
> >> encoding="UTF-8"?><ns2:Notify xmlns:ns2="
> >> http://docs.oasis-open.org/wsn/b-2"
> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
> >> Example
> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus status
> =
> >> getStatus()
> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
> >> STATO
> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
> >> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >> DEBUG - JMSFlow                        - Called Flow send
> >> INFO  - DeliveryChannelImpl            - DOPO
> >> container.sendExchange(mirror);
> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> >> DEBUG - ActiveMQSession                - Sending message:
> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> messageId
> >> =
> >> ID:martina-39597-1199704995676-3:0:1:1:6, originalDestination = null,
> >> originalTransactionId = null, producerId =
> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
> expiration
> >> =
> >> 0, timestamp = 1199705011183, arrival = 0, correlationId = null,
> replyTo
> >> =
> >> null, persistent = true, type = null, priority = 4, groupID = null,
> >> groupSequence = 0, targetConsumerId = null, compressed = false, userID
> =
> >> null, content = org.apache.activemq.util.ByteSequence@c70f32,
> >> marshalledProperties = null, dataStructure = null, redeliveryCounter =
> 0,
> >> size = 0, properties = null, readOnlyProperties = true, readOnlyBody =
> >> true,
> >> droppable = false}
> >> INFO  - DeliveryChannelImpl            - DOPO
> >> container.sendExchange(mirror);
> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
> InOnly[
> >>  id: ID:192.168.0.172-11753fdefba-2:0
> >>  status: Done
> >>  role: provider
> >>  endpoint: endpoint
> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
> >> Example
> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> >> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> ]
> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus status
> =
> >> getStatus()
> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
> >> STATO
> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
> >> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >> DEBUG - JMSFlow                        - Called Flow send
> >> DEBUG - WSNSpringComponent             - Received exchange: status:
> Done,
> >> role: consumer
> >> DEBUG - WSNSpringComponent             - Retrieved correlation id: null
> >> DEBUG - ActiveMQSession                - Sending message:
> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> messageId
> >> =
> >> ID:martina-39597-1199704995676-3:0:1:1:7, originalDestination = null,
> >> originalTransactionId = null, producerId =
> >> ID:martina-39597-1199704995676-3:0:1:1, destination =
> >> queue://org.apache.servicemix.jms.{
> >> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> ,
> >> transactionId = null, expiration = 0, timestamp = 1199705011188,
> arrival
> >> =
> >> 0, correlationId = null, replyTo = null, persistent = true, type =
> null,
> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
> null,
> >> compressed = false, userID = null, content =
> >> org.apache.activemq.util.ByteSequence@1c8f59c, marshalledProperties =
> >> null,
> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
> null,
> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
> >> INFO  - DeliveryChannelImpl            - DOPO
> >> container.sendExchange(mirror);
> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> ERROR - JMSFlow                        - Caught an exception routing
> >> ExchangePacket:
> >> javax.jbi.messaging.MessagingException: illegal call to send / sendSync
> >>        at
> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> >> MessageExchangeImpl.java:581)
> >>        at
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> >> DeliveryChannelImpl.java:384)
> >>        at
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> >> DeliveryChannelImpl.java:444)
> >>        at
> >> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
> >> :249)
> >>        at
> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> >> SubscriberComponent.java:203)
> >>        at
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> >> DeliveryChannelImpl.java:621)
> >>        at
> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> >> AbstractFlow.java:174)
> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
> >> JMSFlow.java:1)
> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
> >> JMSFlow.java:543)
> >>        at
> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> >> (ThreadPoolExecutor.java:665)
> >>        at
> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> >> (ThreadPoolExecutor.java:690)
> >>        at java.lang.Thread.run(Thread.java:595)
> >>
> >> Can you help me again?
> >> Thanks in advance!
> >>
> >> Martina
> >>
> >>
> >>
> >> gnodet wrote:
> >> >
> >> > You need to use an InOnly or RobustInOnly exchange, not an InOut
> >> exchange,
> >> > as notifications do not have any out messages.
> >> >
> >> > On Jan 4, 2008 5:16 PM, martymusk <ma...@email.it> wrote:
> >> >
> >> >>
> >> >> Thus , I've created a new class "SubscriberComponent" that is a copy
> >> of
> >> >> PublisherComponent. Trhough it instance2 receive exchange and try to
> >> send
> >> >> scambio (copy of exchange). When I run example the following error
> >> >> occurs...
> >> >>
> >> >> DEBUG - JMSFlow                        - Called Flow send
> >> >> DEBUG - ActiveMQSession                - Sending message:
> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> >> messageId
> >> >> =
> >> >> ID:martina-38529-1199462112612-3:0:1:1:6, originalDestination =
> null,
> >> >> originalTransactionId = null, producerId =
> >> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
> >> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
> >> expiration
> >> >> =
> >> >> 0, timestamp = 1199462153935, arrival = 0, correlationId = null,
> >> replyTo
> >> >> =
> >> >> null, persistent = true, type = null, priority = 4, groupID = null,
> >> >> groupSequence = 0, targetConsumerId = null, compressed = false,
> userID
> >> =
> >> >> null, content = org.apache.activemq.util.ByteSequence@b2175,
> >> >> marshalledProperties = null, dataStructure = null, redeliveryCounter
> =
> >> 0,
> >> >> size = 0, properties = null, readOnlyProperties = true, readOnlyBody
> =
> >> >> true,
> >> >> droppable = false}
> >> >> DEBUG - WSNSpringComponent             - Received exchange: status:
> >> >> Active,
> >> >> role: consumer
> >> >> DEBUG - WSNSpringComponent             - Retrieved correlation id:
> >> null
> >> >> INFO  - DeliveryChannelImpl            - DOPO
> >> >> container.sendExchange(mirror);
> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> >> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> >> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> >> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
> >> InOut[
> >> >>  id: ID:192.168.0.172-1174583cdf9-2:0
> >> >>  status: Active
> >> >>  role: provider
> >> >>  endpoint: endpoint
> >> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> >> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> >> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >> >>
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
> >> >> Example
> >> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> >> >> Job</fullname><description/><fireTime>Fri Jan 04 16:55:53 CET
> >> >>
> >> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> >> ]
> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
> >> status
> >> =
> >> >> getStatus()
> >> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA
> LO
> >> >> STATO
> >> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
> >> >> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
> >> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> >> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >> >> DEBUG - JMSFlow                        - Called Flow send
> >> >> DEBUG - ActiveMQSession                - Sending message:
> >> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> >> messageId
> >> >> =
> >> >> ID:martina-38529-1199462112612-3:0:1:1:7, originalDestination =
> null,
> >> >> originalTransactionId = null, producerId =
> >> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
> >> >> queue://org.apache.servicemix.jms.{
> >> >>
> >> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> >> ,
> >> >> transactionId = null, expiration = 0, timestamp = 1199462153952,
> >> arrival
> >> >> =
> >> >> 0, correlationId = null, replyTo = null, persistent = true, type =
> >> null,
> >> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
> >> null,
> >> >> compressed = false, userID = null, content =
> >> >> org.apache.activemq.util.ByteSequence@779b3e, marshalledProperties =
> >> >> null,
> >> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
> >> null,
> >> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
> >> >> INFO  - DeliveryChannelImpl            - DOPO
> >> >> container.sendExchange(mirror);
> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> >> ERROR - JMSFlow                        - Caught an exception routing
> >> >> ExchangePacket:
> >> >> javax.jbi.messaging.MessagingException: illegal call to send /
> >> sendSync
> >> >>        at
> >> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> >> >> MessageExchangeImpl.java:581)
> >> >>        at
> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> >> >> DeliveryChannelImpl.java:384)
> >> >>        at
> >> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> >> >> DeliveryChannelImpl.java:444)
> >> >>        at
> >> >>
> >> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
> >> >> :249)
> >> >>        at
> >> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> >> >> SubscriberComponent.java:203)
> >> >>        at
> >> >>
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> >> >> DeliveryChannelImpl.java:621)
> >> >>        at
> >> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> >> >> AbstractFlow.java:174)
> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
> >> >> JMSFlow.java:1)
> >> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
> >> >> JMSFlow.java:543)
> >> >>        at
> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> >> >> (ThreadPoolExecutor.java:665)
> >> >>        at
> >> >>
> >> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> >> >> (ThreadPoolExecutor.java:690)
> >> >>        at java.lang.Thread.run(Thread.java:595)
> >> >>
> >> >> I do wrong again?
> >> >>
> >> >> Thank you!!!
> >> >> Martina
> >> >>
> >> >>
> >> >> gnodet wrote:
> >> >> >
> >> >> > You should have a look at the existing code:
> >> >> >
> >> >> >
> >> >>
> >>
> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/spring/PublisherComponent.java?r=602828
> >> >> >
> >> >> > Note that the publisher component actually use the client api
> (line
> >> >> 172).
> >> >> > For details on thow the client api works (which is how to send a
> JBI
> >> >> > exchange to the WSN broker), see:
> >> >> >
> >> >> >
> >> >>
> >>
> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/client/NotificationBroker.java?r=602828#l89
> >> >> >
> >> >> > I would advise you to start from the publisher component, copy it
> >> and
> >> >> use
> >> >> > it
> >> >> > instead of your TraceComponent.
> >> >> > Each time it receives a JBI exchange, it will publish it through
> the
> >> >> > WSNotification broker.
> >> >> >
> >> >> > Also look at the various resources on the web site that may help
> >> you:
> >> >> >   http://servicemix.apache.org/servicemix-wsn2005.html
> >> >> >   http://servicemix.apache.org/example-scenario.html
> >> >> >
> >> >> >
> >> >> >
> >> >> > On Jan 4, 2008 2:58 PM, martymusk <ma...@email.it> wrote:
> >> >> >
> >> >> >>
> >> >> >> Hy gnodet and thank you very much for your helpfulness,
> >> >> >> but I don't understand exactly what I must to do.
> >> >> >>
> >> >> >> How can I send JBI exchange to the WSN broker directly?
> >> >> >> How can I use WSN client api.
> >> >> >>
> >> >> >> I'm working for a thesis at University of Naples.
> >> >> >> My purpose is to study WSN performance.
> >> >> >> I've found your WSN implementation very useful for me, but to
> study
> >> >> >> performance, I need exchange was send back.
> >> >> >> It is more than a mounth I'm triyng to do this.
> >> >> >>
> >> >> >> I would be very grateful if you can help me. Otherwise, there are
> >> no
> >> >> >> problems, I'll keep on study over and over again, hoping I be
> able
> >> to
> >> >> >> achieve my purpose.
> >> >> >>
> >> >> >> Thank you very much.
> >> >> >> Martina
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> gnodet wrote:
> >> >> >> >
> >> >> >> > I thought I pointed you to the right direction.
> >> >> >> > Do not use the PublisherComponent that way: either use it as it
> >> is
> >> >> >> > intended
> >> >> >> > (deploy it as a component onto the lightweight container) or
> use
> >> the
> >> >> >> WSN
> >> >> >> > client api:
> >> >> >> >    wsn.notify(topic, msg)
> >> >> >> >
> >> >> >> > I'm not sure what you are trying to achieve with your
> >> >> TraceComponent.
> >> >> >>  It
> >> >> >> > sounds like you want to reimplement the PublisherComponent.  If
> >> so,
> >> >> you
> >> >> >> > should have a look at how it is implemented and patch it.
> >> >> >> >
> >> >> >> > Also note that both PublisherComponent and the WSN client api
> are
> >> >> just
> >> >> >> > sugar, you can send a JBI exchange to the WSN broker directly
> if
> >> you
> >> >> >> want.
> >> >> >> >
> >> >> >> > On Jan 4, 2008 2:13 PM, martymusk <ma...@email.it> wrote:
> >> >> >> >
> >> >> >> >>
> >> >> >> >> My problem is always the same!
> >> >> >> >> In wsn-example, after Consumer received an exchange, I'd like
> it
> >> >> send
> >> >> >> >> copy
> >> >> >> >> of it. But it doesn't happen. :-(
> >> >> >> >> I've modified TraceComponent class in the following way, but
> it
> >> >> >> doesn't
> >> >> >> >> work
> >> >> >> >> fine:
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> package org.apache.servicemix.wsn;
> >> >> >> >>
> >> >> >> >> import java.io.StringWriter;
> >> >> >> >>
> >> >> >> >> import javax.jbi.JBIException;
> >> >> >> >> import javax.jbi.messaging.ExchangeStatus;
> >> >> >> >> import javax.jbi.messaging.MessageExchange;
> >> >> >> >> import javax.jbi.messaging.MessagingException;
> >> >> >> >> import javax.jbi.messaging.NormalizedMessage;
> >> >> >> >> import javax.xml.bind.JAXBContext;
> >> >> >> >> import javax.xml.transform.Source;
> >> >> >> >> import javax.xml.transform.TransformerException;
> >> >> >> >> //import javax.jbi.messaging.InOut;
> >> >> >> >>
> >> >> >> >> import org.apache.servicemix.jbi.messaging.MessageExchangeImpl
> ;
> >> >> >> >> import org.apache.servicemix.jbi.messaging.InOutImpl;
> >> >> >> >> import org.apache.commons.logging.Log;
> >> >> >> >> import org.apache.commons.logging.LogFactory;
> >> >> >> >> import org.apache.servicemix.MessageExchangeListener;
> >> >> >> >> import org.apache.servicemix.components.util.ComponentSupport;
> >> >> >> >> import org.apache.servicemix.wsn.spring.PublisherComponent;
> >> >> >> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
> >> >> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
> >> >> >> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
> >> >> >> >> import org.apache.servicemix.wsn.client.NotificationBroker;
> >> >> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
> >> >> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
> >> >> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
> >> >> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
> >> >> >> >> import org.w3c.dom.Element;
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> public class TraceComponent extends ComponentSupport
> implements
> >> >> >> >>                MessageExchangeListener {
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>        private Log log =
> >> LogFactory.getLog(TraceComponent.class);
> >> >> >> >>
> >> >> >> >>        private SourceTransformer sourceTransformer = new
> >> >> >> >> SourceTransformer();
> >> >> >> >>
> >> >> >> >>        public Log getLog() {
> >> >> >> >>                return log;
> >> >> >> >>        }
> >> >> >> >>
> >> >> >> >>        public void setLog(Log log) {
> >> >> >> >>                this.log = log;
> >> >> >> >>        }
> >> >> >> >>
> >> >> >> >>        public SourceTransformer getSourceTransformer() {
> >> >> >> >>                return sourceTransformer;
> >> >> >> >>        }
> >> >> >> >>
> >> >> >> >>        public void setSourceTransformer(SourceTransformer
> >> >> >> >> sourceTransformer) {
> >> >> >> >>                this.sourceTransformer = sourceTransformer;
> >> >> >> >>        }
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>        //AGGIUNGO CODICE
> >> >> >> >>
> >> >> >> >>        PublisherComponent publisher = new
> PublisherComponent();
> >> >> >> >>          private String subscriptionEndpoint = "subscription";
> >> >> >> >>          private NotificationBroker wsnBroker;
> >> >> >> >>          private String topic;
> >> >> >> >>          private String msg;
> >> >> >> >>          private boolean demand;
> >> >> >> >>          private Subscribe subscription;
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>          public String getTopic() {
> >> >> >> >>                return topic;
> >> >> >> >>            }
> >> >> >> >>
> >> >> >> >>            /**
> >> >> >> >>             * @param topic The topic to set.
> >> >> >> >>             */
> >> >> >> >>            public void setTopic(String topic) {
> >> >> >> >>               this.topic = topic;
> >> >> >> >>            }
> >> >> >> >>
> >> >> >> >>         public void init() throws JBIException {
> >> >> >> >>                super.init();
> >> >> >> >>                getContext().activateEndpoint(getService(),
> >> >> >> >> subscriptionEndpoint);
> >> >> >> >>                 log.info("METODO INIT");
> >> >> >> >>                // publisher.init();
> >> >> >> >>
> >> >> >> >>                 publisher.setTopic(topic);
> >> >> >> >>            }
> >> >> >> >>
> >> >> >> >>            /* (non-Javadoc)
> >> >> >> >>             * @see javax.jbi.management.LifeCycleMBean#start()
> >> >> >> >>             */
> >> >> >> >>            public void start() throws JBIException {
> >> >> >> >>
> >> >> >> >>                log.info("METODO START");
> >> >> >> >>                //publisher.start();
> >> >> >> >>                new Thread() {
> >> >> >> >>                  public void run() {
> >> >> >> >>                       try {
> >> >> >> >>                           wsnBroker = new
> >> >> >> >> NotificationBroker(getContext());
> >> >> >> >>
> >> >> >> >>                           String wsaAddress =
> >> >> >> >> getService().getNamespaceURI() + "/"
> >> >> >> >> + getService().getLocalPart() + "/" + subscriptionEndpoint;
> >> >> >> >>
> >> >> >> >>
> >> >> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
> >> >> >> >>                                                       topic,
> >> >> >> >>
>  demand);
> >> >> >> >>                        } catch (Exception e) {
> >> >> >> >>                            log.error("Could not create wsn
> >> client",
> >> >> >> e);
> >> >> >> >>                        }
> >> >> >> >>                    }
> >> >> >> >>                }.start();
> >> >> >> >>            }
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>            public void shutDown() throws JBIException {
> >> >> >> >>                log.info("METODO SHUTDOWN");
> >> >> >> >>            //  publisher.shutDown();
> >> >> >> >>               super.shutDown();
> >> >> >> >>            }
> >> >> >> >>
> >> >> >> >>            //FINE CODICE AGGIUNTO
> >> >> >> >>
> >> >> >> >>        public void onMessageExchange(MessageExchange exchange)
> >> >> >> >>                        throws MessagingException {
> >> >> >> >>                // lets dump the incoming message
> >> >> >> >>                NormalizedMessage message = exchange.getMessage
> >> >> ("in");
> >> >> >> >>                if (message == null) {
> >> >> >> >>                        log.warn("Received null message from
> >> >> exchange:
> >> >> >> "
> >> >> >> +
> >> >> >> >> exchange);
> >> >> >> >>                } else {
> >> >> >> >>                        log.info("Exchange: " + exchange + "
> >> >> received
> >> >> >> IN
> >> >> >> >> message: "
> >> >> >> >>                                        + message);
> >> >> >> >>                        try {
> >> >> >> >>                                log.info("Body is: "
> >> >> >> >>                                                +
> >> >> >> >> sourceTransformer.toString(message.getContent()));
> >> >> >> >>                        } catch (TransformerException e) {
> >> >> >> >>                                log.error("Failed to turn
> message
> >> >> body
> >> >> >> >> into
> >> >> >> >> text: " + e, e);
> >> >> >> >>                        }
> >> >> >> >>                }
> >> >> >> >>                done(exchange);
> >> >> >> >>                log.info("MESSAGGIO RICEVUTO");
> >> >> >> >>
> >> >> >> >>                log.info("COPIO IL PACCHETTO");
> >> >> >> >>
> >> >> >> >>                MessageExchange scambio =
> >> (MessageExchange)exchange;
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>                log.info("INVIO");
> >> >> >> >>
> >> >> >> >>          try{
> >> >> >> >>
> >> >> >> >>                log.info("FASE INVIO");
> >> >> >> >>                //publisher.onMessageExchange(scambio);
> >> >> >> >>
> >> >> >> >>                //AGGIUNGO onMessageExchange
> >> >> >> >>
> >> >> >> >>                if (exchange.getStatus() !=
> >> ExchangeStatus.ACTIVE)
> >> {
> >> >> >> >>                    return;
> >> >> >> >>                }
> >> >> >> >>                // This is a notification from the WSN broker
> >> >> >> >>                if
> >> >> >> >>
> >> >> >>
> >> >>
> >> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
> >> >> >> {
> >> >> >> >>                    try {
> >> >> >> >>                        JAXBContext jaxbContext =
> >> >> >> >> JAXBContext.newInstance(Subscribe.class);
> >> >> >> >>                        Source src = exchange.getMessage
> >> >> >> >> ("in").getContent();
> >> >> >> >>                        Object input =
> >> >> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
> >> >> >> >>                        if (input instanceof Subscribe) {
> >> >> >> >>                            subscription = (Subscribe) input;
> >> >> >> >>                            SubscribeResponse response = new
> >> >> >> >> SubscribeResponse();
> >> >> >> >>                            String wsaAddress =
> >> >> >> >> getService().getNamespaceURI() +
> >> >> >> >> "/" + getService().getLocalPart() + "/" +
> subscriptionEndpoint;
> >> >> >> >>
> >> >> >> >> response.setSubscriptionReference(AbstractWSAClient.createWSA
> >> >> >> >> (wsaAddress));
> >> >> >> >>                            StringWriter writer = new
> >> >> StringWriter();
> >> >> >> >>                            jaxbContext.createMarshaller
> >> >> >> >> ().marshal(response,
> >> >> >> >> writer);
> >> >> >> >>                            NormalizedMessage out =
> >> >> >> exchange.createMessage
> >> >> >> >> ();
> >> >> >> >>                            out.setContent(new
> >> >> >> >> StringSource(writer.toString
> >> >> >> >> ()));
> >> >> >> >>                            exchange.setMessage(out, "out");
> >> >> >> >>                            send(exchange);
> >> >> >> >>
> >> >> >> >>                        } else if (input instanceof
> Unsubscribe)
> >> {
> >> >> >> >>                            subscription = null;
> >> >> >> >>                            UnsubscribeResponse response = new
> >> >> >> >> UnsubscribeResponse();
> >> >> >> >>                            StringWriter writer = new
> >> >> StringWriter();
> >> >> >> >>                            jaxbContext.createMarshaller
> >> >> >> >> ().marshal(response,
> >> >> >> >> writer);
> >> >> >> >>                            NormalizedMessage out =
> >> >> >> exchange.createMessage
> >> >> >> >> ();
> >> >> >> >>                            out.setContent(new
> >> >> >> >> StringSource(writer.toString
> >> >> >> >> ()));
> >> >> >> >>                            exchange.setMessage(out, "out");
> >> >> >> >>                            send(exchange);
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>                        } else {
> >> >> >> >>                            throw new Exception("Unkown
> >> request");
> >> >> >> >>                        }
> >> >> >> >>                    } catch (Exception e) {
> >> >> >> >>                        fail(exchange, e);
> >> >> >> >>                    }
> >> >> >> >>                // This is a notification to publish
> >> >> >> >>                }
> >> >> >> >>
> >> >> >> >>                  else {
> >> >> >> >>                    try {
> >> >> >> >>
> >> >> >> >>                    log.info("SALTA");
> >> >> >> >>                        if (!demand || subscription != null) {
> >> >> >> >>                                log.info("ENTRO NELL'IF");
> >> >> >> >>                           // Element elem = new
> >> >> >> >> SourceTransformer().toDOMElement(exchange.getMessage("in"));
> >> >> >> >>                            log.info("PRIMA DI WSNBROKER");
> >> >> >> >>                            wsnBroker.notify(topic, msg);
> >> >> >> >>                            log.info("PRIMA DI DONE");
> >> >> >> >>
>  getDeliveryChannel().send(exchange);
> >> >> >> >>                            log.info("DOPO DI DONE");
> >> >> >> >>                        } else {
> >> >> >> >>                            log.info("Ingore notification as
> the
> >> >> >> publisher
> >> >> >> >> is no
> >> >> >> >> subscribers");
> >> >> >> >>                        }
> >> >> >> >>                    } catch (Exception e) {
> >> >> >> >>                        fail(exchange, e);
> >> >> >> >>                        }
> >> >> >> >>
> >> >> >> >>                log.debug("IL PACCHETTO INVIATO E': " +
> scambio);
> >> >> >> >>
> >> >> >> >>                  }
> >> >> >> >>                //FINE onMessageExchange
> >> >> >> >>
> >> >> >> >>           } catch(JBIException e){
> >> >> >> >>                  log.error("ECCEZIONE GENERATA!");
> >> >> >> >>          }
> >> >> >> >>
> >> >> >> >>      log.info("INVIATO");
> >> >> >> >> }
> >> >> >> >> }
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> Help me if you can.
> >> >> >> >> Thank you very much for your helpfulness...
> >> >> >> >>
> >> >> >> >> Martina
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> gnodet wrote:
> >> >> >> >> >
> >> >> >> >> > You should not have to deal nor see the internal state of
> the
> >> >> >> exchange.
> >> >> >> >> > If guess you have an exception when trying to send an
> >> exchange,
> >> >> but
> >> >> >> >> this
> >> >> >> >> > means that there is a problem in your code.  You should post
> a
> >> >> >> snippet
> >> >> >> >> of
> >> >> >> >> > your code that is failing so that we can help you.
> >> >> >> >> >
> >> >> >> >> > On Jan 4, 2008 12:22 PM, martymusk <ma...@email.it>
> wrote:
> >> >> >> >> >
> >> >> >> >> >>
> >> >> >> >> >> Hy,
> >> >> >> >> >> I've a question...
> >> >> >> >> >> can I set anywhere Consumer to CAN_SEND?
> >> >> >> >> >>
> >> >> >> >> >> I hope you can help me.
> >> >> >> >> >> Thank you in advance.
> >> >> >> >> >>
> >> >> >> >> >> Martina
> >> >> >> >> >> --
> >> >> >> >> >> View this message in context:
> >> >> >> >> >>
> >> >> >>
> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
> >> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
> >> >> Nabble.com.
> >> >> >> >> >>
> >> >> >> >> >>
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > --
> >> >> >> >> > Cheers,
> >> >> >> >> > Guillaume Nodet
> >> >> >> >> > ------------------------
> >> >> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >> --
> >> >> >> >> View this message in context:
> >> >> >> >>
> >> >>
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616107.html
> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
> >> Nabble.com.
> >> >> >> >>
> >> >> >> >>
> >> >> >> >
> >> >> >> >
> >> >> >> > --
> >> >> >> > Cheers,
> >> >> >> > Guillaume Nodet
> >> >> >> > ------------------------
> >> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context:
> >> >> >>
> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616748.html
> >> >> >> Sent from the ServiceMix - User mailing list archive at
> Nabble.com.
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >> > --
> >> >> > Cheers,
> >> >> > Guillaume Nodet
> >> >> > ------------------------
> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14619757.html
> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > Cheers,
> >> > Guillaume Nodet
> >> > ------------------------
> >> > Blog: http://gnodet.blogspot.com/
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14663812.html
> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> > ------------------------
> > Blog: http://gnodet.blogspot.com/
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14664874.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: Consumer Can Send

Posted by martymusk <ma...@email.it>.
Thank you very much...
The exception is the same, I post it:

INFO  - DeliveryChannelImpl            - TERMINE DI doSend
INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
INFO  - SubscriberComponent            - COPIO IL PACCHETTO
INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E': InOnly[
  id: ID:192.168.0.172-11754495367-2:0
  status: Done
  role: provider
  endpoint: endpoint
  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
xmlns="http://www.w3.org/2005/08/addressing"
xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
xmlns:ns4="http://docs.oasis-open.org/wsn/t-1"><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My Example
Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
Job</fullname><description/><fireTime>Mon Jan 07 13:46:56 CET
2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
]
INFO  - DeliveryChannelImpl            - ENTRO IN doSend
INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
INFO  - MessageExchangeImpl            - ENTRA IN handleSend
INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus status =
getStatus()
INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO STATO
INFO  - MessageExchangeImpl            - TERMINA handleSend
INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
INFO  - DeliveryChannelImpl            - DOPO DI
mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
INFO  - DeliveryChannelImpl            - ESCE DALL'IF
DEBUG - JMSFlow                        - Called Flow send
DEBUG - ActiveMQSession                - Sending message:
ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId =
ID:martina-39867-1199709997721-3:0:1:1:7, originalDestination = null,
originalTransactionId = null, producerId =
ID:martina-39867-1199709997721-3:0:1:1, destination =
queue://org.apache.servicemix.jms.{http://servicemix.org/wsnotification}NotificationBroker:Broker,
transactionId = null, expiration = 0, timestamp = 1199710016807, arrival =
0, correlationId = null, replyTo = null, persistent = true, type = null,
priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
compressed = false, userID = null, content =
org.apache.activemq.util.ByteSequence@5ac5f, marshalledProperties = null,
dataStructure = null, redeliveryCounter = 0, size = 0, properties = null,
readOnlyProperties = true, readOnlyBody = true, droppable = false}
INFO  - DeliveryChannelImpl            - DOPO
container.sendExchange(mirror);
INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
INFO  - DeliveryChannelImpl            - RICHIAMO doSend
INFO  - DeliveryChannelImpl            - ENTRO IN doSend
INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
INFO  - MessageExchangeImpl            - ENTRA IN handleSend
INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
INFO  - DeliveryChannelImpl            - RICHIAMO doSend
INFO  - DeliveryChannelImpl            - ENTRO IN doSend
INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
INFO  - MessageExchangeImpl            - ENTRA IN handleSend
INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
ERROR - JMSFlow                        - Caught an exception routing
ExchangePacket: 
javax.jbi.messaging.MessagingException: illegal call to send / sendSync
	at
org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(MessageExchangeImpl.java:581)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:384)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:444)
	at
org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java:249)
	at
org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(SubscriberComponent.java:204)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:621)
	at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
	at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(JMSFlow.java:1)
	at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(JMSFlow.java:543)
	at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
	at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
	at java.lang.Thread.run(Thread.java:595)
javax.jbi.messaging.MessagingException: illegal call to send / sendSync
	at
org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(MessageExchangeImpl.java:581)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:384)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:444)
	at
org.apache.servicemix.components.util.PojoSupport.done(PojoSupport.java:193)
	at
org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(SubscriberComponent.java:198)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:621)
	at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
	at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(JMSFlow.java:1)
	at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(JMSFlow.java:543)
	at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
	at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
	at java.lang.Thread.run(Thread.java:595)

What do I do wrong?
Thanks in advance!

Martina


gnodet wrote:
> 
> Just before calling fail(exchange, e), could you display the stack trace
> of
> the exception ?
>    e.printStackTrace()
> and send this error ?
> This is the real error, but it seems to be hidden by fail() throwing
> another
> excepiton.
> 
> On Jan 7, 2008 12:32 PM, martymusk <ma...@email.it> wrote:
> 
>>
>> Hy gnodet,
>> thank you for your felpfulness.
>> Thus, I've used InOnly exchange, but I've the same error.
>> I post you my class and the error.
>>
>> package org.apache.servicemix.wsn;
>>
>>
>> import java.io.StringWriter;
>>
>> import javax.jbi.JBIException;
>> import javax.jbi.messaging.ExchangeStatus;
>> import javax.jbi.messaging.MessageExchange;
>> import javax.jbi.messaging.MessagingException;
>> import javax.jbi.messaging.NormalizedMessage;
>> import javax.xml.bind.JAXBContext;
>> import javax.xml.transform.Source;
>> import javax.xml.transform.TransformerException;
>>
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> import org.apache.servicemix.MessageExchangeListener;
>> import org.apache.servicemix.components.util.ComponentSupport;
>> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
>> import org.apache.servicemix.jbi.jaxp.StringSource;
>> import org.apache.servicemix.wsn.client.AbstractWSAClient;
>> import org.apache.servicemix.wsn.client.NotificationBroker;
>> import org.oasis_open.docs.wsn.b_2.Subscribe;
>> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
>> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
>> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
>> import org.w3c.dom.Element;
>>
>>
>>
>>
>>
>>
>>  public class SubscriberComponent extends ComponentSupport implements
>> MessageExchangeListener {
>>
>>            private static final Log log =
>> LogFactory.getLog(SubscriberComponent.class);
>>
>>            private NotificationBroker wsnBroker;
>>            private String receiveTopic;
>>            private boolean demand;
>>            private String subscriptionEndpoint = "subscription";
>>            private Subscribe subscription;
>>
>>            /**
>>             * @return Returns the demand.
>>             */
>>            public boolean getDemand() {
>>                return demand;
>>            }
>>
>>            /**
>>             * @param demand The demand to set.
>>             */
>>            public void setDemand(boolean demand) {
>>                this.demand = demand;
>>            }
>>
>>            /**
>>             * @return Returns the topic.
>>             */
>>            public String getTopic() {
>>                return receiveTopic;
>>            }
>>
>>            /**
>>             * @param topic The topic to set.
>>             */
>>            public void setTopic(String receiveTopic) {
>>                this.receiveTopic = receiveTopic;
>>            }
>>
>>            /**
>>             * @return Returns the subscription.
>>             */
>>            public Subscribe getSubscription() {
>>                return subscription;
>>            }
>>
>>            /* (non-Javadoc)
>>             * @see
>> org.apache.servicemix.jbi.management.BaseLifeCycle#init
>> ()
>>             */
>>            public void init() throws JBIException {
>>                super.init();
>>                getContext().activateEndpoint(getService(),
>> subscriptionEndpoint);
>>            }
>>
>>            /* (non-Javadoc)
>>             * @see javax.jbi.management.LifeCycleMBean#start()
>>             */
>>            public void start() throws JBIException {
>>                new Thread() {
>>                    public void run() {
>>                        try {
>>                            wsnBroker = new
>> NotificationBroker(getContext());
>>                            String wsaAddress =
>> getService().getNamespaceURI() +
>> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>>
>> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
>>                                                        receiveTopic,
>>                                                        demand);
>>                        } catch (Exception e) {
>>                            log.error("Could not create wsn client", e);
>>                        }
>>                    }
>>                }.start();
>>            }
>>
>>
>>            private SourceTransformer sourceTransformer = new
>> SourceTransformer();
>>
>>            public SourceTransformer getSourceTransformer() {
>>                        return sourceTransformer;
>>                }
>>
>>                public void setSourceTransformer(SourceTransformer
>> sourceTransformer) {
>>                        this.sourceTransformer = sourceTransformer;
>>                }
>>
>>            /* (non-Javadoc)
>>             * @see javax.jbi.management.LifeCycleMBean#shutDown()
>>             */
>>            public void shutDown() throws JBIException {
>>                super.shutDown();
>>            }
>>
>>            /* (non-Javadoc)
>>             * @see
>> org.apache.servicemix.MessageExchangeListener#onMessageExchange(
>> javax.jbi.messaging.MessageExchange)
>>             */
>>            public void onMessageExchange(MessageExchange exchange) throws
>> MessagingException {
>>
>>                NormalizedMessage message = exchange.getMessage("in");
>>                        if (message == null) {
>>                                log.warn("Received null message from
>> exchange: " + exchange);
>>                        } else {
>>                                log.info("Exchange: " + exchange + "
>> received IN message: "
>>                                                + message);
>>                                try {
>>                                        log.info("Body is: "
>>                                                        +
>> sourceTransformer.toString(message.getContent()));
>>                                } catch (TransformerException e) {
>>                                        log.error("Failed to turn message
>> body into text: " + e, e);
>>                                }
>>                        }
>>                        done(exchange);
>>                        log.info("MESSAGGIO RICEVUTO");
>>
>>                  log.info("COPIO IL PACCHETTO");
>>
>>                        MessageExchange scambio =
>> (MessageExchange)exchange;
>>                        log.info("IL PACCHETTO COPIATO E': " +scambio);
>>
>>
>>                if (exchange.getStatus() != ExchangeStatus.DONE) {
>>                        log.info("RITORNA PERCHE' LO STATO E': "
>> +exchange.getStatus());
>>                    return;
>>                }
>>                // This is a notification from the WSN broker
>>                if
>> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint)) {
>>                    try {
>>                        JAXBContext jaxbContext =
>> JAXBContext.newInstance(Subscribe.class);
>>                        Source src = exchange.getMessage
>> ("in").getContent();
>>                        Object input =
>> jaxbContext.createUnmarshaller().unmarshal(src);
>>                        if (input instanceof Subscribe) {
>>                            subscription = (Subscribe) input;
>>                            SubscribeResponse response = new
>> SubscribeResponse();
>>                            String wsaAddress =
>> getService().getNamespaceURI() +
>> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>>
>> response.setSubscriptionReference(AbstractWSAClient.createWSA
>> (wsaAddress));
>>                            StringWriter writer = new StringWriter();
>>                            jaxbContext.createMarshaller
>> ().marshal(response,
>> writer);
>>                            NormalizedMessage out = exchange.createMessage
>> ();
>>                            out.setContent(new
>> StringSource(writer.toString
>> ()));
>>                            exchange.setMessage(out, "out");
>>                            send(exchange);
>>
>>                        } else if (input instanceof Unsubscribe) {
>>                            subscription = null;
>>                            UnsubscribeResponse response = new
>> UnsubscribeResponse();
>>                            StringWriter writer = new StringWriter();
>>                            jaxbContext.createMarshaller
>> ().marshal(response,
>> writer);
>>                            NormalizedMessage out = exchange.createMessage
>> ();
>>                            out.setContent(new
>> StringSource(writer.toString
>> ()));
>>                            exchange.setMessage(out, "out");
>>                            send(exchange);
>>
>>
>>                        } else {
>>                            throw new Exception("Unkown request");
>>                        }
>>                    } catch (Exception e) {
>>                        fail(exchange, e);
>>                    }
>>                // This is a notification to publish
>>                }
>>
>>                  else {
>>                    try {
>>                        if (!demand || subscription != null) {
>>                            Element elem = new
>> SourceTransformer().toDOMElement(exchange.getMessage("in"));
>>                            wsnBroker.notify(receiveTopic, elem);
>>                            done(exchange);
>>                        } else {
>>                            log.info("Ingore notification as the publisher
>> is no
>> subscribers");
>>                        }
>>                    } catch (Exception e) {
>>                        fail(exchange, e);
>>                        }
>>                }
>>            }
>>
>>  }
>>
>>  ......
>> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> DEBUG - JMSFlow                        - Called Flow send
>> DEBUG - ActiveMQSession                - Sending message:
>> ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId
>> =
>> ID:martina-39597-1199704995676-3:0:1:1:5, originalDestination = null,
>> originalTransactionId = null, producerId =
>> ID:martina-39597-1199704995676-3:0:1:1, destination =
>> queue://org.apache.servicemix.jms.{
>> http://servicemix.apache.org/demo}trace:endpoint<http://servicemix.apache.org/demo%7Dtrace:endpoint>
>> ,
>> transactionId = null, expiration = 0, timestamp = 1199705011173, arrival
>> =
>> 0, correlationId = null, replyTo = null, persistent = true, type = null,
>> priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
>> compressed = false, userID = null, content =
>> org.apache.activemq.util.ByteSequence@10a69f0, marshalledProperties =
>> null,
>> dataStructure = null, redeliveryCounter = 0, size = 0, properties = null,
>> readOnlyProperties = true, readOnlyBody = true, droppable = false}
>> INFO  - SubscriberComponent            - Exchange: InOnly[
>>  id: ID:192.168.0.172-11753fdefba-2:0
>>  status: Active
>>  role: provider
>>  endpoint: endpoint
>>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> xmlns="http://www.w3.org/2005/08/addressing"
>> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> Example
>> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> ] received IN message:
>>
>> org.apache.servicemix.jbi.messaging.NormalizedMessageImpl@b125bd{properties
>> :
>> {}}
>> INFO  - SubscriberComponent            - Body is: <?xml version="1.0"
>> encoding="UTF-8"?><ns2:Notify xmlns:ns2="
>> http://docs.oasis-open.org/wsn/b-2"
>> xmlns="http://www.w3.org/2005/08/addressing"
>> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> Example
>> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus status =
>> getStatus()
>> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
>> STATO
>> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
>> INFO  - DeliveryChannelImpl            - DOPO DI
>> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> DEBUG - JMSFlow                        - Called Flow send
>> INFO  - DeliveryChannelImpl            - DOPO
>> container.sendExchange(mirror);
>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> DEBUG - ActiveMQSession                - Sending message:
>> ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId
>> =
>> ID:martina-39597-1199704995676-3:0:1:1:6, originalDestination = null,
>> originalTransactionId = null, producerId =
>> ID:martina-39597-1199704995676-3:0:1:1, destination =
>> queue://org.apache.servicemix.jms.wsn2, transactionId = null, expiration
>> =
>> 0, timestamp = 1199705011183, arrival = 0, correlationId = null, replyTo
>> =
>> null, persistent = true, type = null, priority = 4, groupID = null,
>> groupSequence = 0, targetConsumerId = null, compressed = false, userID =
>> null, content = org.apache.activemq.util.ByteSequence@c70f32,
>> marshalledProperties = null, dataStructure = null, redeliveryCounter = 0,
>> size = 0, properties = null, readOnlyProperties = true, readOnlyBody =
>> true,
>> droppable = false}
>> INFO  - DeliveryChannelImpl            - DOPO
>> container.sendExchange(mirror);
>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E': InOnly[
>>  id: ID:192.168.0.172-11753fdefba-2:0
>>  status: Done
>>  role: provider
>>  endpoint: endpoint
>>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> xmlns="http://www.w3.org/2005/08/addressing"
>> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> Example
>> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> ]
>> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
>> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus status =
>> getStatus()
>> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
>> STATO
>> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
>> INFO  - DeliveryChannelImpl            - DOPO DI
>> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> DEBUG - JMSFlow                        - Called Flow send
>> DEBUG - WSNSpringComponent             - Received exchange: status: Done,
>> role: consumer
>> DEBUG - WSNSpringComponent             - Retrieved correlation id: null
>> DEBUG - ActiveMQSession                - Sending message:
>> ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId
>> =
>> ID:martina-39597-1199704995676-3:0:1:1:7, originalDestination = null,
>> originalTransactionId = null, producerId =
>> ID:martina-39597-1199704995676-3:0:1:1, destination =
>> queue://org.apache.servicemix.jms.{
>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> ,
>> transactionId = null, expiration = 0, timestamp = 1199705011188, arrival
>> =
>> 0, correlationId = null, replyTo = null, persistent = true, type = null,
>> priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
>> compressed = false, userID = null, content =
>> org.apache.activemq.util.ByteSequence@1c8f59c, marshalledProperties =
>> null,
>> dataStructure = null, redeliveryCounter = 0, size = 0, properties = null,
>> readOnlyProperties = true, readOnlyBody = true, droppable = false}
>> INFO  - DeliveryChannelImpl            - DOPO
>> container.sendExchange(mirror);
>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> ERROR - JMSFlow                        - Caught an exception routing
>> ExchangePacket:
>> javax.jbi.messaging.MessagingException: illegal call to send / sendSync
>>        at
>> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> MessageExchangeImpl.java:581)
>>        at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>> DeliveryChannelImpl.java:384)
>>        at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> DeliveryChannelImpl.java:444)
>>        at
>> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
>> :249)
>>        at
>> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> SubscriberComponent.java:203)
>>        at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> DeliveryChannelImpl.java:621)
>>        at
>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> AbstractFlow.java:174)
>>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
>> JMSFlow.java:1)
>>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>> JMSFlow.java:543)
>>        at
>>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> (ThreadPoolExecutor.java:665)
>>        at
>>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> (ThreadPoolExecutor.java:690)
>>        at java.lang.Thread.run(Thread.java:595)
>>
>> Can you help me again?
>> Thanks in advance!
>>
>> Martina
>>
>>
>>
>> gnodet wrote:
>> >
>> > You need to use an InOnly or RobustInOnly exchange, not an InOut
>> exchange,
>> > as notifications do not have any out messages.
>> >
>> > On Jan 4, 2008 5:16 PM, martymusk <ma...@email.it> wrote:
>> >
>> >>
>> >> Thus , I've created a new class "SubscriberComponent" that is a copy
>> of
>> >> PublisherComponent. Trhough it instance2 receive exchange and try to
>> send
>> >> scambio (copy of exchange). When I run example the following error
>> >> occurs...
>> >>
>> >> DEBUG - JMSFlow                        - Called Flow send
>> >> DEBUG - ActiveMQSession                - Sending message:
>> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> messageId
>> >> =
>> >> ID:martina-38529-1199462112612-3:0:1:1:6, originalDestination = null,
>> >> originalTransactionId = null, producerId =
>> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
>> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
>> expiration
>> >> =
>> >> 0, timestamp = 1199462153935, arrival = 0, correlationId = null,
>> replyTo
>> >> =
>> >> null, persistent = true, type = null, priority = 4, groupID = null,
>> >> groupSequence = 0, targetConsumerId = null, compressed = false, userID
>> =
>> >> null, content = org.apache.activemq.util.ByteSequence@b2175,
>> >> marshalledProperties = null, dataStructure = null, redeliveryCounter =
>> 0,
>> >> size = 0, properties = null, readOnlyProperties = true, readOnlyBody =
>> >> true,
>> >> droppable = false}
>> >> DEBUG - WSNSpringComponent             - Received exchange: status:
>> >> Active,
>> >> role: consumer
>> >> DEBUG - WSNSpringComponent             - Retrieved correlation id:
>> null
>> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> container.sendExchange(mirror);
>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
>> InOut[
>> >>  id: ID:192.168.0.172-1174583cdf9-2:0
>> >>  status: Active
>> >>  role: provider
>> >>  endpoint: endpoint
>> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> >> xmlns="http://www.w3.org/2005/08/addressing"
>> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> >>
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> >> Example
>> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> >> Job</fullname><description/><fireTime>Fri Jan 04 16:55:53 CET
>> >>
>> >>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> >> ]
>> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
>> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus
>> status
>> =
>> >> getStatus()
>> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
>> >> STATO
>> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> >> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
>> >> INFO  - DeliveryChannelImpl            - DOPO DI
>> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> >> DEBUG - JMSFlow                        - Called Flow send
>> >> DEBUG - ActiveMQSession                - Sending message:
>> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
>> messageId
>> >> =
>> >> ID:martina-38529-1199462112612-3:0:1:1:7, originalDestination = null,
>> >> originalTransactionId = null, producerId =
>> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
>> >> queue://org.apache.servicemix.jms.{
>> >>
>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> >> ,
>> >> transactionId = null, expiration = 0, timestamp = 1199462153952,
>> arrival
>> >> =
>> >> 0, correlationId = null, replyTo = null, persistent = true, type =
>> null,
>> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
>> null,
>> >> compressed = false, userID = null, content =
>> >> org.apache.activemq.util.ByteSequence@779b3e, marshalledProperties =
>> >> null,
>> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
>> null,
>> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
>> >> INFO  - DeliveryChannelImpl            - DOPO
>> >> container.sendExchange(mirror);
>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> >> ERROR - JMSFlow                        - Caught an exception routing
>> >> ExchangePacket:
>> >> javax.jbi.messaging.MessagingException: illegal call to send /
>> sendSync
>> >>        at
>> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> >> MessageExchangeImpl.java:581)
>> >>        at
>> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>> >> DeliveryChannelImpl.java:384)
>> >>        at
>> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> >> DeliveryChannelImpl.java:444)
>> >>        at
>> >>
>> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
>> >> :249)
>> >>        at
>> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> >> SubscriberComponent.java:203)
>> >>        at
>> >>
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> >> DeliveryChannelImpl.java:621)
>> >>        at
>> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> >> AbstractFlow.java:174)
>> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
>> >> JMSFlow.java:1)
>> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>> >> JMSFlow.java:543)
>> >>        at
>> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> >> (ThreadPoolExecutor.java:665)
>> >>        at
>> >>
>> >>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> >> (ThreadPoolExecutor.java:690)
>> >>        at java.lang.Thread.run(Thread.java:595)
>> >>
>> >> I do wrong again?
>> >>
>> >> Thank you!!!
>> >> Martina
>> >>
>> >>
>> >> gnodet wrote:
>> >> >
>> >> > You should have a look at the existing code:
>> >> >
>> >> >
>> >>
>> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/spring/PublisherComponent.java?r=602828
>> >> >
>> >> > Note that the publisher component actually use the client api (line
>> >> 172).
>> >> > For details on thow the client api works (which is how to send a JBI
>> >> > exchange to the WSN broker), see:
>> >> >
>> >> >
>> >>
>> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/client/NotificationBroker.java?r=602828#l89
>> >> >
>> >> > I would advise you to start from the publisher component, copy it
>> and
>> >> use
>> >> > it
>> >> > instead of your TraceComponent.
>> >> > Each time it receives a JBI exchange, it will publish it through the
>> >> > WSNotification broker.
>> >> >
>> >> > Also look at the various resources on the web site that may help
>> you:
>> >> >   http://servicemix.apache.org/servicemix-wsn2005.html
>> >> >   http://servicemix.apache.org/example-scenario.html
>> >> >
>> >> >
>> >> >
>> >> > On Jan 4, 2008 2:58 PM, martymusk <ma...@email.it> wrote:
>> >> >
>> >> >>
>> >> >> Hy gnodet and thank you very much for your helpfulness,
>> >> >> but I don't understand exactly what I must to do.
>> >> >>
>> >> >> How can I send JBI exchange to the WSN broker directly?
>> >> >> How can I use WSN client api.
>> >> >>
>> >> >> I'm working for a thesis at University of Naples.
>> >> >> My purpose is to study WSN performance.
>> >> >> I've found your WSN implementation very useful for me, but to study
>> >> >> performance, I need exchange was send back.
>> >> >> It is more than a mounth I'm triyng to do this.
>> >> >>
>> >> >> I would be very grateful if you can help me. Otherwise, there are
>> no
>> >> >> problems, I'll keep on study over and over again, hoping I be able
>> to
>> >> >> achieve my purpose.
>> >> >>
>> >> >> Thank you very much.
>> >> >> Martina
>> >> >>
>> >> >>
>> >> >>
>> >> >> gnodet wrote:
>> >> >> >
>> >> >> > I thought I pointed you to the right direction.
>> >> >> > Do not use the PublisherComponent that way: either use it as it
>> is
>> >> >> > intended
>> >> >> > (deploy it as a component onto the lightweight container) or use
>> the
>> >> >> WSN
>> >> >> > client api:
>> >> >> >    wsn.notify(topic, msg)
>> >> >> >
>> >> >> > I'm not sure what you are trying to achieve with your
>> >> TraceComponent.
>> >> >>  It
>> >> >> > sounds like you want to reimplement the PublisherComponent.  If
>> so,
>> >> you
>> >> >> > should have a look at how it is implemented and patch it.
>> >> >> >
>> >> >> > Also note that both PublisherComponent and the WSN client api are
>> >> just
>> >> >> > sugar, you can send a JBI exchange to the WSN broker directly if
>> you
>> >> >> want.
>> >> >> >
>> >> >> > On Jan 4, 2008 2:13 PM, martymusk <ma...@email.it> wrote:
>> >> >> >
>> >> >> >>
>> >> >> >> My problem is always the same!
>> >> >> >> In wsn-example, after Consumer received an exchange, I'd like it
>> >> send
>> >> >> >> copy
>> >> >> >> of it. But it doesn't happen. :-(
>> >> >> >> I've modified TraceComponent class in the following way, but it
>> >> >> doesn't
>> >> >> >> work
>> >> >> >> fine:
>> >> >> >>
>> >> >> >>
>> >> >> >> package org.apache.servicemix.wsn;
>> >> >> >>
>> >> >> >> import java.io.StringWriter;
>> >> >> >>
>> >> >> >> import javax.jbi.JBIException;
>> >> >> >> import javax.jbi.messaging.ExchangeStatus;
>> >> >> >> import javax.jbi.messaging.MessageExchange;
>> >> >> >> import javax.jbi.messaging.MessagingException;
>> >> >> >> import javax.jbi.messaging.NormalizedMessage;
>> >> >> >> import javax.xml.bind.JAXBContext;
>> >> >> >> import javax.xml.transform.Source;
>> >> >> >> import javax.xml.transform.TransformerException;
>> >> >> >> //import javax.jbi.messaging.InOut;
>> >> >> >>
>> >> >> >> import org.apache.servicemix.jbi.messaging.MessageExchangeImpl;
>> >> >> >> import org.apache.servicemix.jbi.messaging.InOutImpl;
>> >> >> >> import org.apache.commons.logging.Log;
>> >> >> >> import org.apache.commons.logging.LogFactory;
>> >> >> >> import org.apache.servicemix.MessageExchangeListener;
>> >> >> >> import org.apache.servicemix.components.util.ComponentSupport;
>> >> >> >> import org.apache.servicemix.wsn.spring.PublisherComponent;
>> >> >> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
>> >> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
>> >> >> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
>> >> >> >> import org.apache.servicemix.wsn.client.NotificationBroker;
>> >> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
>> >> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
>> >> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
>> >> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
>> >> >> >> import org.w3c.dom.Element;
>> >> >> >>
>> >> >> >>
>> >> >> >> public class TraceComponent extends ComponentSupport implements
>> >> >> >>                MessageExchangeListener {
>> >> >> >>
>> >> >> >>
>> >> >> >>        private Log log =
>> LogFactory.getLog(TraceComponent.class);
>> >> >> >>
>> >> >> >>        private SourceTransformer sourceTransformer = new
>> >> >> >> SourceTransformer();
>> >> >> >>
>> >> >> >>        public Log getLog() {
>> >> >> >>                return log;
>> >> >> >>        }
>> >> >> >>
>> >> >> >>        public void setLog(Log log) {
>> >> >> >>                this.log = log;
>> >> >> >>        }
>> >> >> >>
>> >> >> >>        public SourceTransformer getSourceTransformer() {
>> >> >> >>                return sourceTransformer;
>> >> >> >>        }
>> >> >> >>
>> >> >> >>        public void setSourceTransformer(SourceTransformer
>> >> >> >> sourceTransformer) {
>> >> >> >>                this.sourceTransformer = sourceTransformer;
>> >> >> >>        }
>> >> >> >>
>> >> >> >>
>> >> >> >>        //AGGIUNGO CODICE
>> >> >> >>
>> >> >> >>        PublisherComponent publisher = new PublisherComponent();
>> >> >> >>          private String subscriptionEndpoint = "subscription";
>> >> >> >>          private NotificationBroker wsnBroker;
>> >> >> >>          private String topic;
>> >> >> >>          private String msg;
>> >> >> >>          private boolean demand;
>> >> >> >>          private Subscribe subscription;
>> >> >> >>
>> >> >> >>
>> >> >> >>          public String getTopic() {
>> >> >> >>                return topic;
>> >> >> >>            }
>> >> >> >>
>> >> >> >>            /**
>> >> >> >>             * @param topic The topic to set.
>> >> >> >>             */
>> >> >> >>            public void setTopic(String topic) {
>> >> >> >>               this.topic = topic;
>> >> >> >>            }
>> >> >> >>
>> >> >> >>         public void init() throws JBIException {
>> >> >> >>                super.init();
>> >> >> >>                getContext().activateEndpoint(getService(),
>> >> >> >> subscriptionEndpoint);
>> >> >> >>                 log.info("METODO INIT");
>> >> >> >>                // publisher.init();
>> >> >> >>
>> >> >> >>                 publisher.setTopic(topic);
>> >> >> >>            }
>> >> >> >>
>> >> >> >>            /* (non-Javadoc)
>> >> >> >>             * @see javax.jbi.management.LifeCycleMBean#start()
>> >> >> >>             */
>> >> >> >>            public void start() throws JBIException {
>> >> >> >>
>> >> >> >>                log.info("METODO START");
>> >> >> >>                //publisher.start();
>> >> >> >>                new Thread() {
>> >> >> >>                  public void run() {
>> >> >> >>                       try {
>> >> >> >>                           wsnBroker = new
>> >> >> >> NotificationBroker(getContext());
>> >> >> >>
>> >> >> >>                           String wsaAddress =
>> >> >> >> getService().getNamespaceURI() + "/"
>> >> >> >> + getService().getLocalPart() + "/" + subscriptionEndpoint;
>> >> >> >>
>> >> >> >>
>> >> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
>> >> >> >>                                                       topic,
>> >> >> >>                                                        demand);
>> >> >> >>                        } catch (Exception e) {
>> >> >> >>                            log.error("Could not create wsn
>> client",
>> >> >> e);
>> >> >> >>                        }
>> >> >> >>                    }
>> >> >> >>                }.start();
>> >> >> >>            }
>> >> >> >>
>> >> >> >>
>> >> >> >>            public void shutDown() throws JBIException {
>> >> >> >>                log.info("METODO SHUTDOWN");
>> >> >> >>            //  publisher.shutDown();
>> >> >> >>               super.shutDown();
>> >> >> >>            }
>> >> >> >>
>> >> >> >>            //FINE CODICE AGGIUNTO
>> >> >> >>
>> >> >> >>        public void onMessageExchange(MessageExchange exchange)
>> >> >> >>                        throws MessagingException {
>> >> >> >>                // lets dump the incoming message
>> >> >> >>                NormalizedMessage message = exchange.getMessage
>> >> ("in");
>> >> >> >>                if (message == null) {
>> >> >> >>                        log.warn("Received null message from
>> >> exchange:
>> >> >> "
>> >> >> +
>> >> >> >> exchange);
>> >> >> >>                } else {
>> >> >> >>                        log.info("Exchange: " + exchange + "
>> >> received
>> >> >> IN
>> >> >> >> message: "
>> >> >> >>                                        + message);
>> >> >> >>                        try {
>> >> >> >>                                log.info("Body is: "
>> >> >> >>                                                +
>> >> >> >> sourceTransformer.toString(message.getContent()));
>> >> >> >>                        } catch (TransformerException e) {
>> >> >> >>                                log.error("Failed to turn message
>> >> body
>> >> >> >> into
>> >> >> >> text: " + e, e);
>> >> >> >>                        }
>> >> >> >>                }
>> >> >> >>                done(exchange);
>> >> >> >>                log.info("MESSAGGIO RICEVUTO");
>> >> >> >>
>> >> >> >>                log.info("COPIO IL PACCHETTO");
>> >> >> >>
>> >> >> >>                MessageExchange scambio =
>> (MessageExchange)exchange;
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>                log.info("INVIO");
>> >> >> >>
>> >> >> >>          try{
>> >> >> >>
>> >> >> >>                log.info("FASE INVIO");
>> >> >> >>                //publisher.onMessageExchange(scambio);
>> >> >> >>
>> >> >> >>                //AGGIUNGO onMessageExchange
>> >> >> >>
>> >> >> >>                if (exchange.getStatus() !=
>> ExchangeStatus.ACTIVE)
>> {
>> >> >> >>                    return;
>> >> >> >>                }
>> >> >> >>                // This is a notification from the WSN broker
>> >> >> >>                if
>> >> >> >>
>> >> >>
>> >>
>> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
>> >> >> {
>> >> >> >>                    try {
>> >> >> >>                        JAXBContext jaxbContext =
>> >> >> >> JAXBContext.newInstance(Subscribe.class);
>> >> >> >>                        Source src = exchange.getMessage
>> >> >> >> ("in").getContent();
>> >> >> >>                        Object input =
>> >> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
>> >> >> >>                        if (input instanceof Subscribe) {
>> >> >> >>                            subscription = (Subscribe) input;
>> >> >> >>                            SubscribeResponse response = new
>> >> >> >> SubscribeResponse();
>> >> >> >>                            String wsaAddress =
>> >> >> >> getService().getNamespaceURI() +
>> >> >> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>> >> >> >>
>> >> >> >> response.setSubscriptionReference(AbstractWSAClient.createWSA
>> >> >> >> (wsaAddress));
>> >> >> >>                            StringWriter writer = new
>> >> StringWriter();
>> >> >> >>                            jaxbContext.createMarshaller
>> >> >> >> ().marshal(response,
>> >> >> >> writer);
>> >> >> >>                            NormalizedMessage out =
>> >> >> exchange.createMessage
>> >> >> >> ();
>> >> >> >>                            out.setContent(new
>> >> >> >> StringSource(writer.toString
>> >> >> >> ()));
>> >> >> >>                            exchange.setMessage(out, "out");
>> >> >> >>                            send(exchange);
>> >> >> >>
>> >> >> >>                        } else if (input instanceof Unsubscribe)
>> {
>> >> >> >>                            subscription = null;
>> >> >> >>                            UnsubscribeResponse response = new
>> >> >> >> UnsubscribeResponse();
>> >> >> >>                            StringWriter writer = new
>> >> StringWriter();
>> >> >> >>                            jaxbContext.createMarshaller
>> >> >> >> ().marshal(response,
>> >> >> >> writer);
>> >> >> >>                            NormalizedMessage out =
>> >> >> exchange.createMessage
>> >> >> >> ();
>> >> >> >>                            out.setContent(new
>> >> >> >> StringSource(writer.toString
>> >> >> >> ()));
>> >> >> >>                            exchange.setMessage(out, "out");
>> >> >> >>                            send(exchange);
>> >> >> >>
>> >> >> >>
>> >> >> >>                        } else {
>> >> >> >>                            throw new Exception("Unkown
>> request");
>> >> >> >>                        }
>> >> >> >>                    } catch (Exception e) {
>> >> >> >>                        fail(exchange, e);
>> >> >> >>                    }
>> >> >> >>                // This is a notification to publish
>> >> >> >>                }
>> >> >> >>
>> >> >> >>                  else {
>> >> >> >>                    try {
>> >> >> >>
>> >> >> >>                    log.info("SALTA");
>> >> >> >>                        if (!demand || subscription != null) {
>> >> >> >>                                log.info("ENTRO NELL'IF");
>> >> >> >>                           // Element elem = new
>> >> >> >> SourceTransformer().toDOMElement(exchange.getMessage("in"));
>> >> >> >>                            log.info("PRIMA DI WSNBROKER");
>> >> >> >>                            wsnBroker.notify(topic, msg);
>> >> >> >>                            log.info("PRIMA DI DONE");
>> >> >> >>                            getDeliveryChannel().send(exchange);
>> >> >> >>                            log.info("DOPO DI DONE");
>> >> >> >>                        } else {
>> >> >> >>                            log.info("Ingore notification as the
>> >> >> publisher
>> >> >> >> is no
>> >> >> >> subscribers");
>> >> >> >>                        }
>> >> >> >>                    } catch (Exception e) {
>> >> >> >>                        fail(exchange, e);
>> >> >> >>                        }
>> >> >> >>
>> >> >> >>                log.debug("IL PACCHETTO INVIATO E': " + scambio);
>> >> >> >>
>> >> >> >>                  }
>> >> >> >>                //FINE onMessageExchange
>> >> >> >>
>> >> >> >>           } catch(JBIException e){
>> >> >> >>                  log.error("ECCEZIONE GENERATA!");
>> >> >> >>          }
>> >> >> >>
>> >> >> >>      log.info("INVIATO");
>> >> >> >> }
>> >> >> >> }
>> >> >> >>
>> >> >> >>
>> >> >> >> Help me if you can.
>> >> >> >> Thank you very much for your helpfulness...
>> >> >> >>
>> >> >> >> Martina
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> gnodet wrote:
>> >> >> >> >
>> >> >> >> > You should not have to deal nor see the internal state of the
>> >> >> exchange.
>> >> >> >> > If guess you have an exception when trying to send an
>> exchange,
>> >> but
>> >> >> >> this
>> >> >> >> > means that there is a problem in your code.  You should post a
>> >> >> snippet
>> >> >> >> of
>> >> >> >> > your code that is failing so that we can help you.
>> >> >> >> >
>> >> >> >> > On Jan 4, 2008 12:22 PM, martymusk <ma...@email.it> wrote:
>> >> >> >> >
>> >> >> >> >>
>> >> >> >> >> Hy,
>> >> >> >> >> I've a question...
>> >> >> >> >> can I set anywhere Consumer to CAN_SEND?
>> >> >> >> >>
>> >> >> >> >> I hope you can help me.
>> >> >> >> >> Thank you in advance.
>> >> >> >> >>
>> >> >> >> >> Martina
>> >> >> >> >> --
>> >> >> >> >> View this message in context:
>> >> >> >> >>
>> >> >>
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
>> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> >> Nabble.com.
>> >> >> >> >>
>> >> >> >> >>
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > --
>> >> >> >> > Cheers,
>> >> >> >> > Guillaume Nodet
>> >> >> >> > ------------------------
>> >> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >> --
>> >> >> >> View this message in context:
>> >> >> >>
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616107.html
>> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> Nabble.com.
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > Cheers,
>> >> >> > Guillaume Nodet
>> >> >> > ------------------------
>> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616748.html
>> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > Cheers,
>> >> > Guillaume Nodet
>> >> > ------------------------
>> >> > Blog: http://gnodet.blogspot.com/
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14619757.html
>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> > Cheers,
>> > Guillaume Nodet
>> > ------------------------
>> > Blog: http://gnodet.blogspot.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14663812.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14664874.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Consumer Can Send

Posted by Guillaume Nodet <gn...@gmail.com>.
Just before calling fail(exchange, e), could you display the stack trace of
the exception ?
   e.printStackTrace()
and send this error ?
This is the real error, but it seems to be hidden by fail() throwing another
excepiton.

On Jan 7, 2008 12:32 PM, martymusk <ma...@email.it> wrote:

>
> Hy gnodet,
> thank you for your felpfulness.
> Thus, I've used InOnly exchange, but I've the same error.
> I post you my class and the error.
>
> package org.apache.servicemix.wsn;
>
>
> import java.io.StringWriter;
>
> import javax.jbi.JBIException;
> import javax.jbi.messaging.ExchangeStatus;
> import javax.jbi.messaging.MessageExchange;
> import javax.jbi.messaging.MessagingException;
> import javax.jbi.messaging.NormalizedMessage;
> import javax.xml.bind.JAXBContext;
> import javax.xml.transform.Source;
> import javax.xml.transform.TransformerException;
>
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> import org.apache.servicemix.MessageExchangeListener;
> import org.apache.servicemix.components.util.ComponentSupport;
> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
> import org.apache.servicemix.jbi.jaxp.StringSource;
> import org.apache.servicemix.wsn.client.AbstractWSAClient;
> import org.apache.servicemix.wsn.client.NotificationBroker;
> import org.oasis_open.docs.wsn.b_2.Subscribe;
> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
> import org.w3c.dom.Element;
>
>
>
>
>
>
>  public class SubscriberComponent extends ComponentSupport implements
> MessageExchangeListener {
>
>            private static final Log log =
> LogFactory.getLog(SubscriberComponent.class);
>
>            private NotificationBroker wsnBroker;
>            private String receiveTopic;
>            private boolean demand;
>            private String subscriptionEndpoint = "subscription";
>            private Subscribe subscription;
>
>            /**
>             * @return Returns the demand.
>             */
>            public boolean getDemand() {
>                return demand;
>            }
>
>            /**
>             * @param demand The demand to set.
>             */
>            public void setDemand(boolean demand) {
>                this.demand = demand;
>            }
>
>            /**
>             * @return Returns the topic.
>             */
>            public String getTopic() {
>                return receiveTopic;
>            }
>
>            /**
>             * @param topic The topic to set.
>             */
>            public void setTopic(String receiveTopic) {
>                this.receiveTopic = receiveTopic;
>            }
>
>            /**
>             * @return Returns the subscription.
>             */
>            public Subscribe getSubscription() {
>                return subscription;
>            }
>
>            /* (non-Javadoc)
>             * @see org.apache.servicemix.jbi.management.BaseLifeCycle#init
> ()
>             */
>            public void init() throws JBIException {
>                super.init();
>                getContext().activateEndpoint(getService(),
> subscriptionEndpoint);
>            }
>
>            /* (non-Javadoc)
>             * @see javax.jbi.management.LifeCycleMBean#start()
>             */
>            public void start() throws JBIException {
>                new Thread() {
>                    public void run() {
>                        try {
>                            wsnBroker = new
> NotificationBroker(getContext());
>                            String wsaAddress =
> getService().getNamespaceURI() +
> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>
> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
>                                                        receiveTopic,
>                                                        demand);
>                        } catch (Exception e) {
>                            log.error("Could not create wsn client", e);
>                        }
>                    }
>                }.start();
>            }
>
>
>            private SourceTransformer sourceTransformer = new
> SourceTransformer();
>
>            public SourceTransformer getSourceTransformer() {
>                        return sourceTransformer;
>                }
>
>                public void setSourceTransformer(SourceTransformer
> sourceTransformer) {
>                        this.sourceTransformer = sourceTransformer;
>                }
>
>            /* (non-Javadoc)
>             * @see javax.jbi.management.LifeCycleMBean#shutDown()
>             */
>            public void shutDown() throws JBIException {
>                super.shutDown();
>            }
>
>            /* (non-Javadoc)
>             * @see
> org.apache.servicemix.MessageExchangeListener#onMessageExchange(
> javax.jbi.messaging.MessageExchange)
>             */
>            public void onMessageExchange(MessageExchange exchange) throws
> MessagingException {
>
>                NormalizedMessage message = exchange.getMessage("in");
>                        if (message == null) {
>                                log.warn("Received null message from
> exchange: " + exchange);
>                        } else {
>                                log.info("Exchange: " + exchange + "
> received IN message: "
>                                                + message);
>                                try {
>                                        log.info("Body is: "
>                                                        +
> sourceTransformer.toString(message.getContent()));
>                                } catch (TransformerException e) {
>                                        log.error("Failed to turn message
> body into text: " + e, e);
>                                }
>                        }
>                        done(exchange);
>                        log.info("MESSAGGIO RICEVUTO");
>
>                  log.info("COPIO IL PACCHETTO");
>
>                        MessageExchange scambio =
> (MessageExchange)exchange;
>                        log.info("IL PACCHETTO COPIATO E': " +scambio);
>
>
>                if (exchange.getStatus() != ExchangeStatus.DONE) {
>                        log.info("RITORNA PERCHE' LO STATO E': "
> +exchange.getStatus());
>                    return;
>                }
>                // This is a notification from the WSN broker
>                if
> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint)) {
>                    try {
>                        JAXBContext jaxbContext =
> JAXBContext.newInstance(Subscribe.class);
>                        Source src = exchange.getMessage
> ("in").getContent();
>                        Object input =
> jaxbContext.createUnmarshaller().unmarshal(src);
>                        if (input instanceof Subscribe) {
>                            subscription = (Subscribe) input;
>                            SubscribeResponse response = new
> SubscribeResponse();
>                            String wsaAddress =
> getService().getNamespaceURI() +
> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>
> response.setSubscriptionReference(AbstractWSAClient.createWSA
> (wsaAddress));
>                            StringWriter writer = new StringWriter();
>                            jaxbContext.createMarshaller
> ().marshal(response,
> writer);
>                            NormalizedMessage out = exchange.createMessage
> ();
>                            out.setContent(new StringSource(writer.toString
> ()));
>                            exchange.setMessage(out, "out");
>                            send(exchange);
>
>                        } else if (input instanceof Unsubscribe) {
>                            subscription = null;
>                            UnsubscribeResponse response = new
> UnsubscribeResponse();
>                            StringWriter writer = new StringWriter();
>                            jaxbContext.createMarshaller
> ().marshal(response,
> writer);
>                            NormalizedMessage out = exchange.createMessage
> ();
>                            out.setContent(new StringSource(writer.toString
> ()));
>                            exchange.setMessage(out, "out");
>                            send(exchange);
>
>
>                        } else {
>                            throw new Exception("Unkown request");
>                        }
>                    } catch (Exception e) {
>                        fail(exchange, e);
>                    }
>                // This is a notification to publish
>                }
>
>                  else {
>                    try {
>                        if (!demand || subscription != null) {
>                            Element elem = new
> SourceTransformer().toDOMElement(exchange.getMessage("in"));
>                            wsnBroker.notify(receiveTopic, elem);
>                            done(exchange);
>                        } else {
>                            log.info("Ingore notification as the publisher
> is no
> subscribers");
>                        }
>                    } catch (Exception e) {
>                        fail(exchange, e);
>                        }
>                }
>            }
>
>  }
>
>  ......
> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> DEBUG - JMSFlow                        - Called Flow send
> DEBUG - ActiveMQSession                - Sending message:
> ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId
> =
> ID:martina-39597-1199704995676-3:0:1:1:5, originalDestination = null,
> originalTransactionId = null, producerId =
> ID:martina-39597-1199704995676-3:0:1:1, destination =
> queue://org.apache.servicemix.jms.{
> http://servicemix.apache.org/demo}trace:endpoint<http://servicemix.apache.org/demo%7Dtrace:endpoint>
> ,
> transactionId = null, expiration = 0, timestamp = 1199705011173, arrival =
> 0, correlationId = null, replyTo = null, persistent = true, type = null,
> priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
> compressed = false, userID = null, content =
> org.apache.activemq.util.ByteSequence@10a69f0, marshalledProperties =
> null,
> dataStructure = null, redeliveryCounter = 0, size = 0, properties = null,
> readOnlyProperties = true, readOnlyBody = true, droppable = false}
> INFO  - SubscriberComponent            - Exchange: InOnly[
>  id: ID:192.168.0.172-11753fdefba-2:0
>  status: Active
>  role: provider
>  endpoint: endpoint
>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> xmlns="http://www.w3.org/2005/08/addressing"
> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My Example
> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> ] received IN message:
>
> org.apache.servicemix.jbi.messaging.NormalizedMessageImpl@b125bd{properties
> :
> {}}
> INFO  - SubscriberComponent            - Body is: <?xml version="1.0"
> encoding="UTF-8"?><ns2:Notify xmlns:ns2="
> http://docs.oasis-open.org/wsn/b-2"
> xmlns="http://www.w3.org/2005/08/addressing"
> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My Example
> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus status =
> getStatus()
> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
> STATO
> INFO  - MessageExchangeImpl            - TERMINA handleSend
> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
> INFO  - DeliveryChannelImpl            - DOPO DI
> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> DEBUG - JMSFlow                        - Called Flow send
> INFO  - DeliveryChannelImpl            - DOPO
> container.sendExchange(mirror);
> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> DEBUG - ActiveMQSession                - Sending message:
> ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId
> =
> ID:martina-39597-1199704995676-3:0:1:1:6, originalDestination = null,
> originalTransactionId = null, producerId =
> ID:martina-39597-1199704995676-3:0:1:1, destination =
> queue://org.apache.servicemix.jms.wsn2, transactionId = null, expiration =
> 0, timestamp = 1199705011183, arrival = 0, correlationId = null, replyTo =
> null, persistent = true, type = null, priority = 4, groupID = null,
> groupSequence = 0, targetConsumerId = null, compressed = false, userID =
> null, content = org.apache.activemq.util.ByteSequence@c70f32,
> marshalledProperties = null, dataStructure = null, redeliveryCounter = 0,
> size = 0, properties = null, readOnlyProperties = true, readOnlyBody =
> true,
> droppable = false}
> INFO  - DeliveryChannelImpl            - DOPO
> container.sendExchange(mirror);
> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E': InOnly[
>  id: ID:192.168.0.172-11753fdefba-2:0
>  status: Done
>  role: provider
>  endpoint: endpoint
>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> xmlns="http://www.w3.org/2005/08/addressing"
> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My Example
> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> ]
> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus status =
> getStatus()
> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
> STATO
> INFO  - MessageExchangeImpl            - TERMINA handleSend
> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
> INFO  - DeliveryChannelImpl            - DOPO DI
> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> DEBUG - JMSFlow                        - Called Flow send
> DEBUG - WSNSpringComponent             - Received exchange: status: Done,
> role: consumer
> DEBUG - WSNSpringComponent             - Retrieved correlation id: null
> DEBUG - ActiveMQSession                - Sending message:
> ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId
> =
> ID:martina-39597-1199704995676-3:0:1:1:7, originalDestination = null,
> originalTransactionId = null, producerId =
> ID:martina-39597-1199704995676-3:0:1:1, destination =
> queue://org.apache.servicemix.jms.{
> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> ,
> transactionId = null, expiration = 0, timestamp = 1199705011188, arrival =
> 0, correlationId = null, replyTo = null, persistent = true, type = null,
> priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
> compressed = false, userID = null, content =
> org.apache.activemq.util.ByteSequence@1c8f59c, marshalledProperties =
> null,
> dataStructure = null, redeliveryCounter = 0, size = 0, properties = null,
> readOnlyProperties = true, readOnlyBody = true, droppable = false}
> INFO  - DeliveryChannelImpl            - DOPO
> container.sendExchange(mirror);
> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> ERROR - JMSFlow                        - Caught an exception routing
> ExchangePacket:
> javax.jbi.messaging.MessagingException: illegal call to send / sendSync
>        at
> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> MessageExchangeImpl.java:581)
>        at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> DeliveryChannelImpl.java:384)
>        at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> DeliveryChannelImpl.java:444)
>        at
> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
> :249)
>        at
> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> SubscriberComponent.java:203)
>        at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> DeliveryChannelImpl.java:621)
>        at
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> AbstractFlow.java:174)
>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
> JMSFlow.java:1)
>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
> JMSFlow.java:543)
>        at
>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> (ThreadPoolExecutor.java:665)
>        at
>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> (ThreadPoolExecutor.java:690)
>        at java.lang.Thread.run(Thread.java:595)
>
> Can you help me again?
> Thanks in advance!
>
> Martina
>
>
>
> gnodet wrote:
> >
> > You need to use an InOnly or RobustInOnly exchange, not an InOut
> exchange,
> > as notifications do not have any out messages.
> >
> > On Jan 4, 2008 5:16 PM, martymusk <ma...@email.it> wrote:
> >
> >>
> >> Thus , I've created a new class "SubscriberComponent" that is a copy of
> >> PublisherComponent. Trhough it instance2 receive exchange and try to
> send
> >> scambio (copy of exchange). When I run example the following error
> >> occurs...
> >>
> >> DEBUG - JMSFlow                        - Called Flow send
> >> DEBUG - ActiveMQSession                - Sending message:
> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> messageId
> >> =
> >> ID:martina-38529-1199462112612-3:0:1:1:6, originalDestination = null,
> >> originalTransactionId = null, producerId =
> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
> >> queue://org.apache.servicemix.jms.wsn2, transactionId = null,
> expiration
> >> =
> >> 0, timestamp = 1199462153935, arrival = 0, correlationId = null,
> replyTo
> >> =
> >> null, persistent = true, type = null, priority = 4, groupID = null,
> >> groupSequence = 0, targetConsumerId = null, compressed = false, userID
> =
> >> null, content = org.apache.activemq.util.ByteSequence@b2175,
> >> marshalledProperties = null, dataStructure = null, redeliveryCounter =
> 0,
> >> size = 0, properties = null, readOnlyProperties = true, readOnlyBody =
> >> true,
> >> droppable = false}
> >> DEBUG - WSNSpringComponent             - Received exchange: status:
> >> Active,
> >> role: consumer
> >> DEBUG - WSNSpringComponent             - Retrieved correlation id: null
> >> INFO  - DeliveryChannelImpl            - DOPO
> >> container.sendExchange(mirror);
> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> >> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> >> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> >> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E':
> InOut[
> >>  id: ID:192.168.0.172-1174583cdf9-2:0
> >>  status: Active
> >>  role: provider
> >>  endpoint: endpoint
> >>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> >> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> >> xmlns="http://www.w3.org/2005/08/addressing"
> >> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> >> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> >>
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> >> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
> >> Example
> >> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> >> Job</fullname><description/><fireTime>Fri Jan 04 16:55:53 CET
> >>
> >>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> >> ]
> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus status
> =
> >> getStatus()
> >> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
> >> STATO
> >> INFO  - MessageExchangeImpl            - TERMINA handleSend
> >> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
> >> INFO  - DeliveryChannelImpl            - DOPO DI
> >> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> >> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> >> DEBUG - JMSFlow                        - Called Flow send
> >> DEBUG - ActiveMQSession                - Sending message:
> >> ActiveMQObjectMessage {commandId = 0, responseRequired = false,
> messageId
> >> =
> >> ID:martina-38529-1199462112612-3:0:1:1:7, originalDestination = null,
> >> originalTransactionId = null, producerId =
> >> ID:martina-38529-1199462112612-3:0:1:1, destination =
> >> queue://org.apache.servicemix.jms.{
> >> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> <http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> >> ,
> >> transactionId = null, expiration = 0, timestamp = 1199462153952,
> arrival
> >> =
> >> 0, correlationId = null, replyTo = null, persistent = true, type =
> null,
> >> priority = 4, groupID = null, groupSequence = 0, targetConsumerId =
> null,
> >> compressed = false, userID = null, content =
> >> org.apache.activemq.util.ByteSequence@779b3e, marshalledProperties =
> >> null,
> >> dataStructure = null, redeliveryCounter = 0, size = 0, properties =
> null,
> >> readOnlyProperties = true, readOnlyBody = true, droppable = false}
> >> INFO  - DeliveryChannelImpl            - DOPO
> >> container.sendExchange(mirror);
> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> >> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> >> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> >> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> >> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> >> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> >> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> >> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> >> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> >> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> >> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> >> ERROR - JMSFlow                        - Caught an exception routing
> >> ExchangePacket:
> >> javax.jbi.messaging.MessagingException: illegal call to send / sendSync
> >>        at
> >> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> >> MessageExchangeImpl.java:581)
> >>        at
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> >> DeliveryChannelImpl.java:384)
> >>        at
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> >> DeliveryChannelImpl.java:444)
> >>        at
> >> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
> >> :249)
> >>        at
> >> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> >> SubscriberComponent.java:203)
> >>        at
> >> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> >> DeliveryChannelImpl.java:621)
> >>        at
> >> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> >> AbstractFlow.java:174)
> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
> >> JMSFlow.java:1)
> >>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
> >> JMSFlow.java:543)
> >>        at
> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> >> (ThreadPoolExecutor.java:665)
> >>        at
> >>
> >>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> >> (ThreadPoolExecutor.java:690)
> >>        at java.lang.Thread.run(Thread.java:595)
> >>
> >> I do wrong again?
> >>
> >> Thank you!!!
> >> Martina
> >>
> >>
> >> gnodet wrote:
> >> >
> >> > You should have a look at the existing code:
> >> >
> >> >
> >>
> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/spring/PublisherComponent.java?r=602828
> >> >
> >> > Note that the publisher component actually use the client api (line
> >> 172).
> >> > For details on thow the client api works (which is how to send a JBI
> >> > exchange to the WSN broker), see:
> >> >
> >> >
> >>
> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/client/NotificationBroker.java?r=602828#l89
> >> >
> >> > I would advise you to start from the publisher component, copy it and
> >> use
> >> > it
> >> > instead of your TraceComponent.
> >> > Each time it receives a JBI exchange, it will publish it through the
> >> > WSNotification broker.
> >> >
> >> > Also look at the various resources on the web site that may help you:
> >> >   http://servicemix.apache.org/servicemix-wsn2005.html
> >> >   http://servicemix.apache.org/example-scenario.html
> >> >
> >> >
> >> >
> >> > On Jan 4, 2008 2:58 PM, martymusk <ma...@email.it> wrote:
> >> >
> >> >>
> >> >> Hy gnodet and thank you very much for your helpfulness,
> >> >> but I don't understand exactly what I must to do.
> >> >>
> >> >> How can I send JBI exchange to the WSN broker directly?
> >> >> How can I use WSN client api.
> >> >>
> >> >> I'm working for a thesis at University of Naples.
> >> >> My purpose is to study WSN performance.
> >> >> I've found your WSN implementation very useful for me, but to study
> >> >> performance, I need exchange was send back.
> >> >> It is more than a mounth I'm triyng to do this.
> >> >>
> >> >> I would be very grateful if you can help me. Otherwise, there are no
> >> >> problems, I'll keep on study over and over again, hoping I be able
> to
> >> >> achieve my purpose.
> >> >>
> >> >> Thank you very much.
> >> >> Martina
> >> >>
> >> >>
> >> >>
> >> >> gnodet wrote:
> >> >> >
> >> >> > I thought I pointed you to the right direction.
> >> >> > Do not use the PublisherComponent that way: either use it as it is
> >> >> > intended
> >> >> > (deploy it as a component onto the lightweight container) or use
> the
> >> >> WSN
> >> >> > client api:
> >> >> >    wsn.notify(topic, msg)
> >> >> >
> >> >> > I'm not sure what you are trying to achieve with your
> >> TraceComponent.
> >> >>  It
> >> >> > sounds like you want to reimplement the PublisherComponent.  If
> so,
> >> you
> >> >> > should have a look at how it is implemented and patch it.
> >> >> >
> >> >> > Also note that both PublisherComponent and the WSN client api are
> >> just
> >> >> > sugar, you can send a JBI exchange to the WSN broker directly if
> you
> >> >> want.
> >> >> >
> >> >> > On Jan 4, 2008 2:13 PM, martymusk <ma...@email.it> wrote:
> >> >> >
> >> >> >>
> >> >> >> My problem is always the same!
> >> >> >> In wsn-example, after Consumer received an exchange, I'd like it
> >> send
> >> >> >> copy
> >> >> >> of it. But it doesn't happen. :-(
> >> >> >> I've modified TraceComponent class in the following way, but it
> >> >> doesn't
> >> >> >> work
> >> >> >> fine:
> >> >> >>
> >> >> >>
> >> >> >> package org.apache.servicemix.wsn;
> >> >> >>
> >> >> >> import java.io.StringWriter;
> >> >> >>
> >> >> >> import javax.jbi.JBIException;
> >> >> >> import javax.jbi.messaging.ExchangeStatus;
> >> >> >> import javax.jbi.messaging.MessageExchange;
> >> >> >> import javax.jbi.messaging.MessagingException;
> >> >> >> import javax.jbi.messaging.NormalizedMessage;
> >> >> >> import javax.xml.bind.JAXBContext;
> >> >> >> import javax.xml.transform.Source;
> >> >> >> import javax.xml.transform.TransformerException;
> >> >> >> //import javax.jbi.messaging.InOut;
> >> >> >>
> >> >> >> import org.apache.servicemix.jbi.messaging.MessageExchangeImpl;
> >> >> >> import org.apache.servicemix.jbi.messaging.InOutImpl;
> >> >> >> import org.apache.commons.logging.Log;
> >> >> >> import org.apache.commons.logging.LogFactory;
> >> >> >> import org.apache.servicemix.MessageExchangeListener;
> >> >> >> import org.apache.servicemix.components.util.ComponentSupport;
> >> >> >> import org.apache.servicemix.wsn.spring.PublisherComponent;
> >> >> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
> >> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
> >> >> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
> >> >> >> import org.apache.servicemix.wsn.client.NotificationBroker;
> >> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
> >> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
> >> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
> >> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
> >> >> >> import org.w3c.dom.Element;
> >> >> >>
> >> >> >>
> >> >> >> public class TraceComponent extends ComponentSupport implements
> >> >> >>                MessageExchangeListener {
> >> >> >>
> >> >> >>
> >> >> >>        private Log log = LogFactory.getLog(TraceComponent.class);
> >> >> >>
> >> >> >>        private SourceTransformer sourceTransformer = new
> >> >> >> SourceTransformer();
> >> >> >>
> >> >> >>        public Log getLog() {
> >> >> >>                return log;
> >> >> >>        }
> >> >> >>
> >> >> >>        public void setLog(Log log) {
> >> >> >>                this.log = log;
> >> >> >>        }
> >> >> >>
> >> >> >>        public SourceTransformer getSourceTransformer() {
> >> >> >>                return sourceTransformer;
> >> >> >>        }
> >> >> >>
> >> >> >>        public void setSourceTransformer(SourceTransformer
> >> >> >> sourceTransformer) {
> >> >> >>                this.sourceTransformer = sourceTransformer;
> >> >> >>        }
> >> >> >>
> >> >> >>
> >> >> >>        //AGGIUNGO CODICE
> >> >> >>
> >> >> >>        PublisherComponent publisher = new PublisherComponent();
> >> >> >>          private String subscriptionEndpoint = "subscription";
> >> >> >>          private NotificationBroker wsnBroker;
> >> >> >>          private String topic;
> >> >> >>          private String msg;
> >> >> >>          private boolean demand;
> >> >> >>          private Subscribe subscription;
> >> >> >>
> >> >> >>
> >> >> >>          public String getTopic() {
> >> >> >>                return topic;
> >> >> >>            }
> >> >> >>
> >> >> >>            /**
> >> >> >>             * @param topic The topic to set.
> >> >> >>             */
> >> >> >>            public void setTopic(String topic) {
> >> >> >>               this.topic = topic;
> >> >> >>            }
> >> >> >>
> >> >> >>         public void init() throws JBIException {
> >> >> >>                super.init();
> >> >> >>                getContext().activateEndpoint(getService(),
> >> >> >> subscriptionEndpoint);
> >> >> >>                 log.info("METODO INIT");
> >> >> >>                // publisher.init();
> >> >> >>
> >> >> >>                 publisher.setTopic(topic);
> >> >> >>            }
> >> >> >>
> >> >> >>            /* (non-Javadoc)
> >> >> >>             * @see javax.jbi.management.LifeCycleMBean#start()
> >> >> >>             */
> >> >> >>            public void start() throws JBIException {
> >> >> >>
> >> >> >>                log.info("METODO START");
> >> >> >>                //publisher.start();
> >> >> >>                new Thread() {
> >> >> >>                  public void run() {
> >> >> >>                       try {
> >> >> >>                           wsnBroker = new
> >> >> >> NotificationBroker(getContext());
> >> >> >>
> >> >> >>                           String wsaAddress =
> >> >> >> getService().getNamespaceURI() + "/"
> >> >> >> + getService().getLocalPart() + "/" + subscriptionEndpoint;
> >> >> >>
> >> >> >>
> >> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
> >> >> >>                                                       topic,
> >> >> >>                                                        demand);
> >> >> >>                        } catch (Exception e) {
> >> >> >>                            log.error("Could not create wsn
> client",
> >> >> e);
> >> >> >>                        }
> >> >> >>                    }
> >> >> >>                }.start();
> >> >> >>            }
> >> >> >>
> >> >> >>
> >> >> >>            public void shutDown() throws JBIException {
> >> >> >>                log.info("METODO SHUTDOWN");
> >> >> >>            //  publisher.shutDown();
> >> >> >>               super.shutDown();
> >> >> >>            }
> >> >> >>
> >> >> >>            //FINE CODICE AGGIUNTO
> >> >> >>
> >> >> >>        public void onMessageExchange(MessageExchange exchange)
> >> >> >>                        throws MessagingException {
> >> >> >>                // lets dump the incoming message
> >> >> >>                NormalizedMessage message = exchange.getMessage
> >> ("in");
> >> >> >>                if (message == null) {
> >> >> >>                        log.warn("Received null message from
> >> exchange:
> >> >> "
> >> >> +
> >> >> >> exchange);
> >> >> >>                } else {
> >> >> >>                        log.info("Exchange: " + exchange + "
> >> received
> >> >> IN
> >> >> >> message: "
> >> >> >>                                        + message);
> >> >> >>                        try {
> >> >> >>                                log.info("Body is: "
> >> >> >>                                                +
> >> >> >> sourceTransformer.toString(message.getContent()));
> >> >> >>                        } catch (TransformerException e) {
> >> >> >>                                log.error("Failed to turn message
> >> body
> >> >> >> into
> >> >> >> text: " + e, e);
> >> >> >>                        }
> >> >> >>                }
> >> >> >>                done(exchange);
> >> >> >>                log.info("MESSAGGIO RICEVUTO");
> >> >> >>
> >> >> >>                log.info("COPIO IL PACCHETTO");
> >> >> >>
> >> >> >>                MessageExchange scambio =
> (MessageExchange)exchange;
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>                log.info("INVIO");
> >> >> >>
> >> >> >>          try{
> >> >> >>
> >> >> >>                log.info("FASE INVIO");
> >> >> >>                //publisher.onMessageExchange(scambio);
> >> >> >>
> >> >> >>                //AGGIUNGO onMessageExchange
> >> >> >>
> >> >> >>                if (exchange.getStatus() != ExchangeStatus.ACTIVE)
> {
> >> >> >>                    return;
> >> >> >>                }
> >> >> >>                // This is a notification from the WSN broker
> >> >> >>                if
> >> >> >>
> >> >>
> >> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
> >> >> {
> >> >> >>                    try {
> >> >> >>                        JAXBContext jaxbContext =
> >> >> >> JAXBContext.newInstance(Subscribe.class);
> >> >> >>                        Source src = exchange.getMessage
> >> >> >> ("in").getContent();
> >> >> >>                        Object input =
> >> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
> >> >> >>                        if (input instanceof Subscribe) {
> >> >> >>                            subscription = (Subscribe) input;
> >> >> >>                            SubscribeResponse response = new
> >> >> >> SubscribeResponse();
> >> >> >>                            String wsaAddress =
> >> >> >> getService().getNamespaceURI() +
> >> >> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
> >> >> >>
> >> >> >> response.setSubscriptionReference(AbstractWSAClient.createWSA
> >> >> >> (wsaAddress));
> >> >> >>                            StringWriter writer = new
> >> StringWriter();
> >> >> >>                            jaxbContext.createMarshaller
> >> >> >> ().marshal(response,
> >> >> >> writer);
> >> >> >>                            NormalizedMessage out =
> >> >> exchange.createMessage
> >> >> >> ();
> >> >> >>                            out.setContent(new
> >> >> >> StringSource(writer.toString
> >> >> >> ()));
> >> >> >>                            exchange.setMessage(out, "out");
> >> >> >>                            send(exchange);
> >> >> >>
> >> >> >>                        } else if (input instanceof Unsubscribe) {
> >> >> >>                            subscription = null;
> >> >> >>                            UnsubscribeResponse response = new
> >> >> >> UnsubscribeResponse();
> >> >> >>                            StringWriter writer = new
> >> StringWriter();
> >> >> >>                            jaxbContext.createMarshaller
> >> >> >> ().marshal(response,
> >> >> >> writer);
> >> >> >>                            NormalizedMessage out =
> >> >> exchange.createMessage
> >> >> >> ();
> >> >> >>                            out.setContent(new
> >> >> >> StringSource(writer.toString
> >> >> >> ()));
> >> >> >>                            exchange.setMessage(out, "out");
> >> >> >>                            send(exchange);
> >> >> >>
> >> >> >>
> >> >> >>                        } else {
> >> >> >>                            throw new Exception("Unkown request");
> >> >> >>                        }
> >> >> >>                    } catch (Exception e) {
> >> >> >>                        fail(exchange, e);
> >> >> >>                    }
> >> >> >>                // This is a notification to publish
> >> >> >>                }
> >> >> >>
> >> >> >>                  else {
> >> >> >>                    try {
> >> >> >>
> >> >> >>                    log.info("SALTA");
> >> >> >>                        if (!demand || subscription != null) {
> >> >> >>                                log.info("ENTRO NELL'IF");
> >> >> >>                           // Element elem = new
> >> >> >> SourceTransformer().toDOMElement(exchange.getMessage("in"));
> >> >> >>                            log.info("PRIMA DI WSNBROKER");
> >> >> >>                            wsnBroker.notify(topic, msg);
> >> >> >>                            log.info("PRIMA DI DONE");
> >> >> >>                            getDeliveryChannel().send(exchange);
> >> >> >>                            log.info("DOPO DI DONE");
> >> >> >>                        } else {
> >> >> >>                            log.info("Ingore notification as the
> >> >> publisher
> >> >> >> is no
> >> >> >> subscribers");
> >> >> >>                        }
> >> >> >>                    } catch (Exception e) {
> >> >> >>                        fail(exchange, e);
> >> >> >>                        }
> >> >> >>
> >> >> >>                log.debug("IL PACCHETTO INVIATO E': " + scambio);
> >> >> >>
> >> >> >>                  }
> >> >> >>                //FINE onMessageExchange
> >> >> >>
> >> >> >>           } catch(JBIException e){
> >> >> >>                  log.error("ECCEZIONE GENERATA!");
> >> >> >>          }
> >> >> >>
> >> >> >>      log.info("INVIATO");
> >> >> >> }
> >> >> >> }
> >> >> >>
> >> >> >>
> >> >> >> Help me if you can.
> >> >> >> Thank you very much for your helpfulness...
> >> >> >>
> >> >> >> Martina
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> gnodet wrote:
> >> >> >> >
> >> >> >> > You should not have to deal nor see the internal state of the
> >> >> exchange.
> >> >> >> > If guess you have an exception when trying to send an exchange,
> >> but
> >> >> >> this
> >> >> >> > means that there is a problem in your code.  You should post a
> >> >> snippet
> >> >> >> of
> >> >> >> > your code that is failing so that we can help you.
> >> >> >> >
> >> >> >> > On Jan 4, 2008 12:22 PM, martymusk <ma...@email.it> wrote:
> >> >> >> >
> >> >> >> >>
> >> >> >> >> Hy,
> >> >> >> >> I've a question...
> >> >> >> >> can I set anywhere Consumer to CAN_SEND?
> >> >> >> >>
> >> >> >> >> I hope you can help me.
> >> >> >> >> Thank you in advance.
> >> >> >> >>
> >> >> >> >> Martina
> >> >> >> >> --
> >> >> >> >> View this message in context:
> >> >> >> >>
> >> >>
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
> >> >> >> >> Sent from the ServiceMix - User mailing list archive at
> >> Nabble.com.
> >> >> >> >>
> >> >> >> >>
> >> >> >> >
> >> >> >> >
> >> >> >> > --
> >> >> >> > Cheers,
> >> >> >> > Guillaume Nodet
> >> >> >> > ------------------------
> >> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> --
> >> >> >> View this message in context:
> >> >> >>
> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616107.html
> >> >> >> Sent from the ServiceMix - User mailing list archive at
> Nabble.com.
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >> > --
> >> >> > Cheers,
> >> >> > Guillaume Nodet
> >> >> > ------------------------
> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616748.html
> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > Cheers,
> >> > Guillaume Nodet
> >> > ------------------------
> >> > Blog: http://gnodet.blogspot.com/
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14619757.html
> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> > ------------------------
> > Blog: http://gnodet.blogspot.com/
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14663812.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: Consumer Can Send

Posted by martymusk <ma...@email.it>.
Hy gnodet,
thank you for your felpfulness.
Thus, I've used InOnly exchange, but I've the same error.
I post you my class and the error.

package org.apache.servicemix.wsn;


import java.io.StringWriter;

import javax.jbi.JBIException;
import javax.jbi.messaging.ExchangeStatus;
import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.MessagingException;
import javax.jbi.messaging.NormalizedMessage;
import javax.xml.bind.JAXBContext;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.MessageExchangeListener;
import org.apache.servicemix.components.util.ComponentSupport;
import org.apache.servicemix.jbi.jaxp.SourceTransformer;
import org.apache.servicemix.jbi.jaxp.StringSource;
import org.apache.servicemix.wsn.client.AbstractWSAClient;
import org.apache.servicemix.wsn.client.NotificationBroker;
import org.oasis_open.docs.wsn.b_2.Subscribe;
import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
import org.oasis_open.docs.wsn.b_2.Unsubscribe;
import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
import org.w3c.dom.Element;





	
  public class SubscriberComponent extends ComponentSupport implements
MessageExchangeListener {

	    private static final Log log =
LogFactory.getLog(SubscriberComponent.class);
	    
	    private NotificationBroker wsnBroker;
	    private String receiveTopic;
	    private boolean demand;
	    private String subscriptionEndpoint = "subscription";
	    private Subscribe subscription;
	    
	    /**
	     * @return Returns the demand.
	     */
	    public boolean getDemand() {
	        return demand;
	    }

	    /**
	     * @param demand The demand to set.
	     */
	    public void setDemand(boolean demand) {
	        this.demand = demand;
	    }

	    /**
	     * @return Returns the topic.
	     */
	    public String getTopic() {
	        return receiveTopic;
	    }

	    /**
	     * @param topic The topic to set.
	     */
	    public void setTopic(String receiveTopic) {
	        this.receiveTopic = receiveTopic;
	    }

	    /**
	     * @return Returns the subscription.
	     */
	    public Subscribe getSubscription() {
	        return subscription;
	    }

	    /* (non-Javadoc)
	     * @see org.apache.servicemix.jbi.management.BaseLifeCycle#init()
	     */
	    public void init() throws JBIException {
	        super.init();
	        getContext().activateEndpoint(getService(), subscriptionEndpoint);
	    }
	    
	    /* (non-Javadoc)
	     * @see javax.jbi.management.LifeCycleMBean#start()
	     */
	    public void start() throws JBIException {
	        new Thread() {
	            public void run() {
	                try {
	                    wsnBroker = new NotificationBroker(getContext());
	                    String wsaAddress = getService().getNamespaceURI() +
"/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
	                   
wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
	                                                receiveTopic,
	                                                demand);
	                } catch (Exception e) {
	                    log.error("Could not create wsn client", e);
	                }
	            }
	        }.start();
	    }
	    
	    
	    private SourceTransformer sourceTransformer = new SourceTransformer();
	    
	    public SourceTransformer getSourceTransformer() {
			return sourceTransformer;
		}

		public void setSourceTransformer(SourceTransformer sourceTransformer) {
			this.sourceTransformer = sourceTransformer;
		}

	    /* (non-Javadoc)
	     * @see javax.jbi.management.LifeCycleMBean#shutDown()
	     */
	    public void shutDown() throws JBIException {
	        super.shutDown();
	    }
	    
	    /* (non-Javadoc)
	     * @see
org.apache.servicemix.MessageExchangeListener#onMessageExchange(javax.jbi.messaging.MessageExchange)
	     */
	    public void onMessageExchange(MessageExchange exchange) throws
MessagingException {
	    	
	    	NormalizedMessage message = exchange.getMessage("in");
			if (message == null) {
				log.warn("Received null message from exchange: " + exchange);
			} else {
				log.info("Exchange: " + exchange + " received IN message: "
						+ message);
				try {
					log.info("Body is: "
							+ sourceTransformer.toString(message.getContent()));
				} catch (TransformerException e) {
					log.error("Failed to turn message body into text: " + e, e);
				}
			}
			done(exchange);
			log.info("MESSAGGIO RICEVUTO");
			
	          log.info("COPIO IL PACCHETTO");
			
			MessageExchange scambio = (MessageExchange)exchange;
			log.info("IL PACCHETTO COPIATO E': " +scambio);
			
			
	        if (exchange.getStatus() != ExchangeStatus.DONE) {
	        	log.info("RITORNA PERCHE' LO STATO E': " +exchange.getStatus());
	            return;
	        }
	        // This is a notification from the WSN broker
	        if
(exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint)) {
	            try {
	                JAXBContext jaxbContext =
JAXBContext.newInstance(Subscribe.class);
	                Source src = exchange.getMessage("in").getContent();
	                Object input =
jaxbContext.createUnmarshaller().unmarshal(src);
	                if (input instanceof Subscribe) {
	                    subscription = (Subscribe) input;
	                    SubscribeResponse response = new SubscribeResponse();
	                    String wsaAddress = getService().getNamespaceURI() +
"/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
	                   
response.setSubscriptionReference(AbstractWSAClient.createWSA(wsaAddress));
	                    StringWriter writer = new StringWriter();
	                    jaxbContext.createMarshaller().marshal(response,
writer);
	                    NormalizedMessage out = exchange.createMessage();
	                    out.setContent(new StringSource(writer.toString()));
	                    exchange.setMessage(out, "out");
	                    send(exchange);
	               
	                } else if (input instanceof Unsubscribe) {
	                    subscription = null;
	                    UnsubscribeResponse response = new
UnsubscribeResponse();
	                    StringWriter writer = new StringWriter();
	                    jaxbContext.createMarshaller().marshal(response,
writer);
	                    NormalizedMessage out = exchange.createMessage();
	                    out.setContent(new StringSource(writer.toString()));
	                    exchange.setMessage(out, "out");
	                    send(exchange);
	                   
	               
	                } else {
	                    throw new Exception("Unkown request");
	                }
	            } catch (Exception e) {
	                fail(exchange, e);
	            }
	        // This is a notification to publish
	        } 

	          else {
	            try {
	                if (!demand || subscription != null) {
	                    Element elem = new
SourceTransformer().toDOMElement(exchange.getMessage("in"));
	                    wsnBroker.notify(receiveTopic, elem);
	                    done(exchange);
	                } else {
	                    log.info("Ingore notification as the publisher is no
subscribers");
	                }
	            } catch (Exception e) {
	                fail(exchange, e);
	                }
	        }
	    }

  }

 ......
INFO  - DeliveryChannelImpl            - ESCE DALL'IF
DEBUG - JMSFlow                        - Called Flow send
DEBUG - ActiveMQSession                - Sending message:
ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId =
ID:martina-39597-1199704995676-3:0:1:1:5, originalDestination = null,
originalTransactionId = null, producerId =
ID:martina-39597-1199704995676-3:0:1:1, destination =
queue://org.apache.servicemix.jms.{http://servicemix.apache.org/demo}trace:endpoint,
transactionId = null, expiration = 0, timestamp = 1199705011173, arrival =
0, correlationId = null, replyTo = null, persistent = true, type = null,
priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
compressed = false, userID = null, content =
org.apache.activemq.util.ByteSequence@10a69f0, marshalledProperties = null,
dataStructure = null, redeliveryCounter = 0, size = 0, properties = null,
readOnlyProperties = true, readOnlyBody = true, droppable = false}
INFO  - SubscriberComponent            - Exchange: InOnly[
  id: ID:192.168.0.172-11753fdefba-2:0
  status: Active
  role: provider
  endpoint: endpoint
  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
xmlns="http://www.w3.org/2005/08/addressing"
xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
xmlns:ns4="http://docs.oasis-open.org/wsn/t-1"><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My Example
Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
] received IN message:
org.apache.servicemix.jbi.messaging.NormalizedMessageImpl@b125bd{properties:
{}}
INFO  - SubscriberComponent            - Body is: <?xml version="1.0"
encoding="UTF-8"?><ns2:Notify xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
xmlns="http://www.w3.org/2005/08/addressing"
xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
xmlns:ns4="http://docs.oasis-open.org/wsn/t-1"><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My Example
Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
INFO  - DeliveryChannelImpl            - RICHIAMO doSend
INFO  - DeliveryChannelImpl            - ENTRO IN doSend
INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
INFO  - MessageExchangeImpl            - ENTRA IN handleSend
INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus status =
getStatus()
INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO STATO
INFO  - MessageExchangeImpl            - TERMINA handleSend
INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
INFO  - DeliveryChannelImpl            - DOPO DI
mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
INFO  - DeliveryChannelImpl            - ESCE DALL'IF
DEBUG - JMSFlow                        - Called Flow send
INFO  - DeliveryChannelImpl            - DOPO
container.sendExchange(mirror);
INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
INFO  - DeliveryChannelImpl            - TERMINE DI doSend
DEBUG - ActiveMQSession                - Sending message:
ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId =
ID:martina-39597-1199704995676-3:0:1:1:6, originalDestination = null,
originalTransactionId = null, producerId =
ID:martina-39597-1199704995676-3:0:1:1, destination =
queue://org.apache.servicemix.jms.wsn2, transactionId = null, expiration =
0, timestamp = 1199705011183, arrival = 0, correlationId = null, replyTo =
null, persistent = true, type = null, priority = 4, groupID = null,
groupSequence = 0, targetConsumerId = null, compressed = false, userID =
null, content = org.apache.activemq.util.ByteSequence@c70f32,
marshalledProperties = null, dataStructure = null, redeliveryCounter = 0,
size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true,
droppable = false}
INFO  - DeliveryChannelImpl            - DOPO
container.sendExchange(mirror);
INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
INFO  - DeliveryChannelImpl            - TERMINE DI doSend
INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
INFO  - SubscriberComponent            - COPIO IL PACCHETTO
INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E': InOnly[
  id: ID:192.168.0.172-11753fdefba-2:0
  status: Done
  role: provider
  endpoint: endpoint
  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
xmlns="http://www.w3.org/2005/08/addressing"
xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
xmlns:ns4="http://docs.oasis-open.org/wsn/t-1"><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My Example
Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
Job</fullname><description/><fireTime>Mon Jan 07 12:23:31 CET
2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
]
INFO  - DeliveryChannelImpl            - ENTRO IN doSend
INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
INFO  - MessageExchangeImpl            - ENTRA IN handleSend
INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus status =
getStatus()
INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO STATO
INFO  - MessageExchangeImpl            - TERMINA handleSend
INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
INFO  - DeliveryChannelImpl            - DOPO DI
mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
INFO  - DeliveryChannelImpl            - ESCE DALL'IF
DEBUG - JMSFlow                        - Called Flow send
DEBUG - WSNSpringComponent             - Received exchange: status: Done,
role: consumer
DEBUG - WSNSpringComponent             - Retrieved correlation id: null
DEBUG - ActiveMQSession                - Sending message:
ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId =
ID:martina-39597-1199704995676-3:0:1:1:7, originalDestination = null,
originalTransactionId = null, producerId =
ID:martina-39597-1199704995676-3:0:1:1, destination =
queue://org.apache.servicemix.jms.{http://servicemix.org/wsnotification}NotificationBroker:Broker,
transactionId = null, expiration = 0, timestamp = 1199705011188, arrival =
0, correlationId = null, replyTo = null, persistent = true, type = null,
priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
compressed = false, userID = null, content =
org.apache.activemq.util.ByteSequence@1c8f59c, marshalledProperties = null,
dataStructure = null, redeliveryCounter = 0, size = 0, properties = null,
readOnlyProperties = true, readOnlyBody = true, droppable = false}
INFO  - DeliveryChannelImpl            - DOPO
container.sendExchange(mirror);
INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
INFO  - DeliveryChannelImpl            - RICHIAMO doSend
INFO  - DeliveryChannelImpl            - ENTRO IN doSend
INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
INFO  - MessageExchangeImpl            - ENTRA IN handleSend
INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
INFO  - DeliveryChannelImpl            - RICHIAMO doSend
INFO  - DeliveryChannelImpl            - ENTRO IN doSend
INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
INFO  - MessageExchangeImpl            - ENTRA IN handleSend
INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
ERROR - JMSFlow                        - Caught an exception routing
ExchangePacket: 
javax.jbi.messaging.MessagingException: illegal call to send / sendSync
	at
org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(MessageExchangeImpl.java:581)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:384)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:444)
	at
org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java:249)
	at
org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(SubscriberComponent.java:203)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:621)
	at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
	at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(JMSFlow.java:1)
	at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(JMSFlow.java:543)
	at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
	at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
	at java.lang.Thread.run(Thread.java:595)

Can you help me again?
Thanks in advance!

Martina



gnodet wrote:
> 
> You need to use an InOnly or RobustInOnly exchange, not an InOut exchange,
> as notifications do not have any out messages.
> 
> On Jan 4, 2008 5:16 PM, martymusk <ma...@email.it> wrote:
> 
>>
>> Thus , I've created a new class "SubscriberComponent" that is a copy of
>> PublisherComponent. Trhough it instance2 receive exchange and try to send
>> scambio (copy of exchange). When I run example the following error
>> occurs...
>>
>> DEBUG - JMSFlow                        - Called Flow send
>> DEBUG - ActiveMQSession                - Sending message:
>> ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId
>> =
>> ID:martina-38529-1199462112612-3:0:1:1:6, originalDestination = null,
>> originalTransactionId = null, producerId =
>> ID:martina-38529-1199462112612-3:0:1:1, destination =
>> queue://org.apache.servicemix.jms.wsn2, transactionId = null, expiration
>> =
>> 0, timestamp = 1199462153935, arrival = 0, correlationId = null, replyTo
>> =
>> null, persistent = true, type = null, priority = 4, groupID = null,
>> groupSequence = 0, targetConsumerId = null, compressed = false, userID =
>> null, content = org.apache.activemq.util.ByteSequence@b2175,
>> marshalledProperties = null, dataStructure = null, redeliveryCounter = 0,
>> size = 0, properties = null, readOnlyProperties = true, readOnlyBody =
>> true,
>> droppable = false}
>> DEBUG - WSNSpringComponent             - Received exchange: status:
>> Active,
>> role: consumer
>> DEBUG - WSNSpringComponent             - Retrieved correlation id: null
>> INFO  - DeliveryChannelImpl            - DOPO
>> container.sendExchange(mirror);
>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
>> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
>> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
>> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E': InOut[
>>  id: ID:192.168.0.172-1174583cdf9-2:0
>>  status: Active
>>  role: provider
>>  endpoint: endpoint
>>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
>> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
>> xmlns="http://www.w3.org/2005/08/addressing"
>> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
>> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
>> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
>> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My
>> Example
>> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
>> Job</fullname><description/><fireTime>Fri Jan 04 16:55:53 CET
>>
>> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
>> ]
>> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
>> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus status =
>> getStatus()
>> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
>> STATO
>> INFO  - MessageExchangeImpl            - TERMINA handleSend
>> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
>> INFO  - DeliveryChannelImpl            - DOPO DI
>> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
>> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
>> DEBUG - JMSFlow                        - Called Flow send
>> DEBUG - ActiveMQSession                - Sending message:
>> ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId
>> =
>> ID:martina-38529-1199462112612-3:0:1:1:7, originalDestination = null,
>> originalTransactionId = null, producerId =
>> ID:martina-38529-1199462112612-3:0:1:1, destination =
>> queue://org.apache.servicemix.jms.{
>> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
>> ,
>> transactionId = null, expiration = 0, timestamp = 1199462153952, arrival
>> =
>> 0, correlationId = null, replyTo = null, persistent = true, type = null,
>> priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
>> compressed = false, userID = null, content =
>> org.apache.activemq.util.ByteSequence@779b3e, marshalledProperties =
>> null,
>> dataStructure = null, redeliveryCounter = 0, size = 0, properties = null,
>> readOnlyProperties = true, readOnlyBody = true, droppable = false}
>> INFO  - DeliveryChannelImpl            - DOPO
>> container.sendExchange(mirror);
>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
>> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
>> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
>> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
>> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
>> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
>> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
>> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
>> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
>> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
>> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
>> ERROR - JMSFlow                        - Caught an exception routing
>> ExchangePacket:
>> javax.jbi.messaging.MessagingException: illegal call to send / sendSync
>>        at
>> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
>> MessageExchangeImpl.java:581)
>>        at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
>> DeliveryChannelImpl.java:384)
>>        at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
>> DeliveryChannelImpl.java:444)
>>        at
>> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
>> :249)
>>        at
>> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
>> SubscriberComponent.java:203)
>>        at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
>> DeliveryChannelImpl.java:621)
>>        at
>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
>> AbstractFlow.java:174)
>>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
>> JMSFlow.java:1)
>>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
>> JMSFlow.java:543)
>>        at
>>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
>> (ThreadPoolExecutor.java:665)
>>        at
>>
>> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
>> (ThreadPoolExecutor.java:690)
>>        at java.lang.Thread.run(Thread.java:595)
>>
>> I do wrong again?
>>
>> Thank you!!!
>> Martina
>>
>>
>> gnodet wrote:
>> >
>> > You should have a look at the existing code:
>> >
>> >
>> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/spring/PublisherComponent.java?r=602828
>> >
>> > Note that the publisher component actually use the client api (line
>> 172).
>> > For details on thow the client api works (which is how to send a JBI
>> > exchange to the WSN broker), see:
>> >
>> >
>> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/client/NotificationBroker.java?r=602828#l89
>> >
>> > I would advise you to start from the publisher component, copy it and
>> use
>> > it
>> > instead of your TraceComponent.
>> > Each time it receives a JBI exchange, it will publish it through the
>> > WSNotification broker.
>> >
>> > Also look at the various resources on the web site that may help you:
>> >   http://servicemix.apache.org/servicemix-wsn2005.html
>> >   http://servicemix.apache.org/example-scenario.html
>> >
>> >
>> >
>> > On Jan 4, 2008 2:58 PM, martymusk <ma...@email.it> wrote:
>> >
>> >>
>> >> Hy gnodet and thank you very much for your helpfulness,
>> >> but I don't understand exactly what I must to do.
>> >>
>> >> How can I send JBI exchange to the WSN broker directly?
>> >> How can I use WSN client api.
>> >>
>> >> I'm working for a thesis at University of Naples.
>> >> My purpose is to study WSN performance.
>> >> I've found your WSN implementation very useful for me, but to study
>> >> performance, I need exchange was send back.
>> >> It is more than a mounth I'm triyng to do this.
>> >>
>> >> I would be very grateful if you can help me. Otherwise, there are no
>> >> problems, I'll keep on study over and over again, hoping I be able to
>> >> achieve my purpose.
>> >>
>> >> Thank you very much.
>> >> Martina
>> >>
>> >>
>> >>
>> >> gnodet wrote:
>> >> >
>> >> > I thought I pointed you to the right direction.
>> >> > Do not use the PublisherComponent that way: either use it as it is
>> >> > intended
>> >> > (deploy it as a component onto the lightweight container) or use the
>> >> WSN
>> >> > client api:
>> >> >    wsn.notify(topic, msg)
>> >> >
>> >> > I'm not sure what you are trying to achieve with your
>> TraceComponent.
>> >>  It
>> >> > sounds like you want to reimplement the PublisherComponent.  If so,
>> you
>> >> > should have a look at how it is implemented and patch it.
>> >> >
>> >> > Also note that both PublisherComponent and the WSN client api are
>> just
>> >> > sugar, you can send a JBI exchange to the WSN broker directly if you
>> >> want.
>> >> >
>> >> > On Jan 4, 2008 2:13 PM, martymusk <ma...@email.it> wrote:
>> >> >
>> >> >>
>> >> >> My problem is always the same!
>> >> >> In wsn-example, after Consumer received an exchange, I'd like it
>> send
>> >> >> copy
>> >> >> of it. But it doesn't happen. :-(
>> >> >> I've modified TraceComponent class in the following way, but it
>> >> doesn't
>> >> >> work
>> >> >> fine:
>> >> >>
>> >> >>
>> >> >> package org.apache.servicemix.wsn;
>> >> >>
>> >> >> import java.io.StringWriter;
>> >> >>
>> >> >> import javax.jbi.JBIException;
>> >> >> import javax.jbi.messaging.ExchangeStatus;
>> >> >> import javax.jbi.messaging.MessageExchange;
>> >> >> import javax.jbi.messaging.MessagingException;
>> >> >> import javax.jbi.messaging.NormalizedMessage;
>> >> >> import javax.xml.bind.JAXBContext;
>> >> >> import javax.xml.transform.Source;
>> >> >> import javax.xml.transform.TransformerException;
>> >> >> //import javax.jbi.messaging.InOut;
>> >> >>
>> >> >> import org.apache.servicemix.jbi.messaging.MessageExchangeImpl;
>> >> >> import org.apache.servicemix.jbi.messaging.InOutImpl;
>> >> >> import org.apache.commons.logging.Log;
>> >> >> import org.apache.commons.logging.LogFactory;
>> >> >> import org.apache.servicemix.MessageExchangeListener;
>> >> >> import org.apache.servicemix.components.util.ComponentSupport;
>> >> >> import org.apache.servicemix.wsn.spring.PublisherComponent;
>> >> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
>> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
>> >> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
>> >> >> import org.apache.servicemix.wsn.client.NotificationBroker;
>> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
>> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
>> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
>> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
>> >> >> import org.w3c.dom.Element;
>> >> >>
>> >> >>
>> >> >> public class TraceComponent extends ComponentSupport implements
>> >> >>                MessageExchangeListener {
>> >> >>
>> >> >>
>> >> >>        private Log log = LogFactory.getLog(TraceComponent.class);
>> >> >>
>> >> >>        private SourceTransformer sourceTransformer = new
>> >> >> SourceTransformer();
>> >> >>
>> >> >>        public Log getLog() {
>> >> >>                return log;
>> >> >>        }
>> >> >>
>> >> >>        public void setLog(Log log) {
>> >> >>                this.log = log;
>> >> >>        }
>> >> >>
>> >> >>        public SourceTransformer getSourceTransformer() {
>> >> >>                return sourceTransformer;
>> >> >>        }
>> >> >>
>> >> >>        public void setSourceTransformer(SourceTransformer
>> >> >> sourceTransformer) {
>> >> >>                this.sourceTransformer = sourceTransformer;
>> >> >>        }
>> >> >>
>> >> >>
>> >> >>        //AGGIUNGO CODICE
>> >> >>
>> >> >>        PublisherComponent publisher = new PublisherComponent();
>> >> >>          private String subscriptionEndpoint = "subscription";
>> >> >>          private NotificationBroker wsnBroker;
>> >> >>          private String topic;
>> >> >>          private String msg;
>> >> >>          private boolean demand;
>> >> >>          private Subscribe subscription;
>> >> >>
>> >> >>
>> >> >>          public String getTopic() {
>> >> >>                return topic;
>> >> >>            }
>> >> >>
>> >> >>            /**
>> >> >>             * @param topic The topic to set.
>> >> >>             */
>> >> >>            public void setTopic(String topic) {
>> >> >>               this.topic = topic;
>> >> >>            }
>> >> >>
>> >> >>         public void init() throws JBIException {
>> >> >>                super.init();
>> >> >>                getContext().activateEndpoint(getService(),
>> >> >> subscriptionEndpoint);
>> >> >>                 log.info("METODO INIT");
>> >> >>                // publisher.init();
>> >> >>
>> >> >>                 publisher.setTopic(topic);
>> >> >>            }
>> >> >>
>> >> >>            /* (non-Javadoc)
>> >> >>             * @see javax.jbi.management.LifeCycleMBean#start()
>> >> >>             */
>> >> >>            public void start() throws JBIException {
>> >> >>
>> >> >>                log.info("METODO START");
>> >> >>                //publisher.start();
>> >> >>                new Thread() {
>> >> >>                  public void run() {
>> >> >>                       try {
>> >> >>                           wsnBroker = new
>> >> >> NotificationBroker(getContext());
>> >> >>
>> >> >>                           String wsaAddress =
>> >> >> getService().getNamespaceURI() + "/"
>> >> >> + getService().getLocalPart() + "/" + subscriptionEndpoint;
>> >> >>
>> >> >>
>> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
>> >> >>                                                       topic,
>> >> >>                                                        demand);
>> >> >>                        } catch (Exception e) {
>> >> >>                            log.error("Could not create wsn client",
>> >> e);
>> >> >>                        }
>> >> >>                    }
>> >> >>                }.start();
>> >> >>            }
>> >> >>
>> >> >>
>> >> >>            public void shutDown() throws JBIException {
>> >> >>                log.info("METODO SHUTDOWN");
>> >> >>            //  publisher.shutDown();
>> >> >>               super.shutDown();
>> >> >>            }
>> >> >>
>> >> >>            //FINE CODICE AGGIUNTO
>> >> >>
>> >> >>        public void onMessageExchange(MessageExchange exchange)
>> >> >>                        throws MessagingException {
>> >> >>                // lets dump the incoming message
>> >> >>                NormalizedMessage message = exchange.getMessage
>> ("in");
>> >> >>                if (message == null) {
>> >> >>                        log.warn("Received null message from
>> exchange:
>> >> "
>> >> +
>> >> >> exchange);
>> >> >>                } else {
>> >> >>                        log.info("Exchange: " + exchange + "
>> received
>> >> IN
>> >> >> message: "
>> >> >>                                        + message);
>> >> >>                        try {
>> >> >>                                log.info("Body is: "
>> >> >>                                                +
>> >> >> sourceTransformer.toString(message.getContent()));
>> >> >>                        } catch (TransformerException e) {
>> >> >>                                log.error("Failed to turn message
>> body
>> >> >> into
>> >> >> text: " + e, e);
>> >> >>                        }
>> >> >>                }
>> >> >>                done(exchange);
>> >> >>                log.info("MESSAGGIO RICEVUTO");
>> >> >>
>> >> >>                log.info("COPIO IL PACCHETTO");
>> >> >>
>> >> >>                MessageExchange scambio = (MessageExchange)exchange;
>> >> >>
>> >> >>
>> >> >>
>> >> >>                log.info("INVIO");
>> >> >>
>> >> >>          try{
>> >> >>
>> >> >>                log.info("FASE INVIO");
>> >> >>                //publisher.onMessageExchange(scambio);
>> >> >>
>> >> >>                //AGGIUNGO onMessageExchange
>> >> >>
>> >> >>                if (exchange.getStatus() != ExchangeStatus.ACTIVE) {
>> >> >>                    return;
>> >> >>                }
>> >> >>                // This is a notification from the WSN broker
>> >> >>                if
>> >> >>
>> >>
>> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
>> >> {
>> >> >>                    try {
>> >> >>                        JAXBContext jaxbContext =
>> >> >> JAXBContext.newInstance(Subscribe.class);
>> >> >>                        Source src = exchange.getMessage
>> >> >> ("in").getContent();
>> >> >>                        Object input =
>> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
>> >> >>                        if (input instanceof Subscribe) {
>> >> >>                            subscription = (Subscribe) input;
>> >> >>                            SubscribeResponse response = new
>> >> >> SubscribeResponse();
>> >> >>                            String wsaAddress =
>> >> >> getService().getNamespaceURI() +
>> >> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>> >> >>
>> >> >> response.setSubscriptionReference(AbstractWSAClient.createWSA
>> >> >> (wsaAddress));
>> >> >>                            StringWriter writer = new
>> StringWriter();
>> >> >>                            jaxbContext.createMarshaller
>> >> >> ().marshal(response,
>> >> >> writer);
>> >> >>                            NormalizedMessage out =
>> >> exchange.createMessage
>> >> >> ();
>> >> >>                            out.setContent(new
>> >> >> StringSource(writer.toString
>> >> >> ()));
>> >> >>                            exchange.setMessage(out, "out");
>> >> >>                            send(exchange);
>> >> >>
>> >> >>                        } else if (input instanceof Unsubscribe) {
>> >> >>                            subscription = null;
>> >> >>                            UnsubscribeResponse response = new
>> >> >> UnsubscribeResponse();
>> >> >>                            StringWriter writer = new
>> StringWriter();
>> >> >>                            jaxbContext.createMarshaller
>> >> >> ().marshal(response,
>> >> >> writer);
>> >> >>                            NormalizedMessage out =
>> >> exchange.createMessage
>> >> >> ();
>> >> >>                            out.setContent(new
>> >> >> StringSource(writer.toString
>> >> >> ()));
>> >> >>                            exchange.setMessage(out, "out");
>> >> >>                            send(exchange);
>> >> >>
>> >> >>
>> >> >>                        } else {
>> >> >>                            throw new Exception("Unkown request");
>> >> >>                        }
>> >> >>                    } catch (Exception e) {
>> >> >>                        fail(exchange, e);
>> >> >>                    }
>> >> >>                // This is a notification to publish
>> >> >>                }
>> >> >>
>> >> >>                  else {
>> >> >>                    try {
>> >> >>
>> >> >>                    log.info("SALTA");
>> >> >>                        if (!demand || subscription != null) {
>> >> >>                                log.info("ENTRO NELL'IF");
>> >> >>                           // Element elem = new
>> >> >> SourceTransformer().toDOMElement(exchange.getMessage("in"));
>> >> >>                            log.info("PRIMA DI WSNBROKER");
>> >> >>                            wsnBroker.notify(topic, msg);
>> >> >>                            log.info("PRIMA DI DONE");
>> >> >>                            getDeliveryChannel().send(exchange);
>> >> >>                            log.info("DOPO DI DONE");
>> >> >>                        } else {
>> >> >>                            log.info("Ingore notification as the
>> >> publisher
>> >> >> is no
>> >> >> subscribers");
>> >> >>                        }
>> >> >>                    } catch (Exception e) {
>> >> >>                        fail(exchange, e);
>> >> >>                        }
>> >> >>
>> >> >>                log.debug("IL PACCHETTO INVIATO E': " + scambio);
>> >> >>
>> >> >>                  }
>> >> >>                //FINE onMessageExchange
>> >> >>
>> >> >>           } catch(JBIException e){
>> >> >>                  log.error("ECCEZIONE GENERATA!");
>> >> >>          }
>> >> >>
>> >> >>      log.info("INVIATO");
>> >> >> }
>> >> >> }
>> >> >>
>> >> >>
>> >> >> Help me if you can.
>> >> >> Thank you very much for your helpfulness...
>> >> >>
>> >> >> Martina
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> gnodet wrote:
>> >> >> >
>> >> >> > You should not have to deal nor see the internal state of the
>> >> exchange.
>> >> >> > If guess you have an exception when trying to send an exchange,
>> but
>> >> >> this
>> >> >> > means that there is a problem in your code.  You should post a
>> >> snippet
>> >> >> of
>> >> >> > your code that is failing so that we can help you.
>> >> >> >
>> >> >> > On Jan 4, 2008 12:22 PM, martymusk <ma...@email.it> wrote:
>> >> >> >
>> >> >> >>
>> >> >> >> Hy,
>> >> >> >> I've a question...
>> >> >> >> can I set anywhere Consumer to CAN_SEND?
>> >> >> >>
>> >> >> >> I hope you can help me.
>> >> >> >> Thank you in advance.
>> >> >> >>
>> >> >> >> Martina
>> >> >> >> --
>> >> >> >> View this message in context:
>> >> >> >>
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
>> >> >> >> Sent from the ServiceMix - User mailing list archive at
>> Nabble.com.
>> >> >> >>
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > Cheers,
>> >> >> > Guillaume Nodet
>> >> >> > ------------------------
>> >> >> > Blog: http://gnodet.blogspot.com/
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616107.html
>> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > Cheers,
>> >> > Guillaume Nodet
>> >> > ------------------------
>> >> > Blog: http://gnodet.blogspot.com/
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616748.html
>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> > Cheers,
>> > Guillaume Nodet
>> > ------------------------
>> > Blog: http://gnodet.blogspot.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14619757.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14663812.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Consumer Can Send

Posted by Guillaume Nodet <gn...@gmail.com>.
You need to use an InOnly or RobustInOnly exchange, not an InOut exchange,
as notifications do not have any out messages.

On Jan 4, 2008 5:16 PM, martymusk <ma...@email.it> wrote:

>
> Thus , I've created a new class "SubscriberComponent" that is a copy of
> PublisherComponent. Trhough it instance2 receive exchange and try to send
> scambio (copy of exchange). When I run example the following error
> occurs...
>
> DEBUG - JMSFlow                        - Called Flow send
> DEBUG - ActiveMQSession                - Sending message:
> ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId
> =
> ID:martina-38529-1199462112612-3:0:1:1:6, originalDestination = null,
> originalTransactionId = null, producerId =
> ID:martina-38529-1199462112612-3:0:1:1, destination =
> queue://org.apache.servicemix.jms.wsn2, transactionId = null, expiration =
> 0, timestamp = 1199462153935, arrival = 0, correlationId = null, replyTo =
> null, persistent = true, type = null, priority = 4, groupID = null,
> groupSequence = 0, targetConsumerId = null, compressed = false, userID =
> null, content = org.apache.activemq.util.ByteSequence@b2175,
> marshalledProperties = null, dataStructure = null, redeliveryCounter = 0,
> size = 0, properties = null, readOnlyProperties = true, readOnlyBody =
> true,
> droppable = false}
> DEBUG - WSNSpringComponent             - Received exchange: status:
> Active,
> role: consumer
> DEBUG - WSNSpringComponent             - Retrieved correlation id: null
> INFO  - DeliveryChannelImpl            - DOPO
> container.sendExchange(mirror);
> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> INFO  - DeliveryChannelImpl            - TERMINE DI doSend
> INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
> INFO  - SubscriberComponent            - COPIO IL PACCHETTO
> INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E': InOut[
>  id: ID:192.168.0.172-1174583cdf9-2:0
>  status: Active
>  role: provider
>  endpoint: endpoint
>  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
> xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
> xmlns="http://www.w3.org/2005/08/addressing"
> xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
> xmlns:ns4="http://docs.oasis-open.org/wsn/t-1
> "><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
> xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My Example
> Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
> Job</fullname><description/><fireTime>Fri Jan 04 16:55:53 CET
>
> 2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
> ]
> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus status =
> getStatus()
> INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO
> STATO
> INFO  - MessageExchangeImpl            - TERMINA handleSend
> INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
> INFO  - DeliveryChannelImpl            - DOPO DI
> mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
> INFO  - DeliveryChannelImpl            - ESCE DALL'IF
> DEBUG - JMSFlow                        - Called Flow send
> DEBUG - ActiveMQSession                - Sending message:
> ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId
> =
> ID:martina-38529-1199462112612-3:0:1:1:7, originalDestination = null,
> originalTransactionId = null, producerId =
> ID:martina-38529-1199462112612-3:0:1:1, destination =
> queue://org.apache.servicemix.jms.{
> http://servicemix.org/wsnotification}NotificationBroker:Broker<http://servicemix.org/wsnotification%7DNotificationBroker:Broker>
> ,
> transactionId = null, expiration = 0, timestamp = 1199462153952, arrival =
> 0, correlationId = null, replyTo = null, persistent = true, type = null,
> priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
> compressed = false, userID = null, content =
> org.apache.activemq.util.ByteSequence@779b3e, marshalledProperties = null,
> dataStructure = null, redeliveryCounter = 0, size = 0, properties = null,
> readOnlyProperties = true, readOnlyBody = true, droppable = false}
> INFO  - DeliveryChannelImpl            - DOPO
> container.sendExchange(mirror);
> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
> INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
> INFO  - DeliveryChannelImpl            - RICHIAMO doSend
> INFO  - DeliveryChannelImpl            - ENTRO IN doSend
> INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
> INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
> INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
> INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
> DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
> INFO  - MessageExchangeImpl            - ENTRA IN handleSend
> INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
> ERROR - JMSFlow                        - Caught an exception routing
> ExchangePacket:
> javax.jbi.messaging.MessagingException: illegal call to send / sendSync
>        at
> org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(
> MessageExchangeImpl.java:581)
>        at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(
> DeliveryChannelImpl.java:384)
>        at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(
> DeliveryChannelImpl.java:444)
>        at
> org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java
> :249)
>        at
> org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(
> SubscriberComponent.java:203)
>        at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
> DeliveryChannelImpl.java:621)
>        at
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
> AbstractFlow.java:174)
>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(
> JMSFlow.java:1)
>        at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(
> JMSFlow.java:543)
>        at
>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
> (ThreadPoolExecutor.java:665)
>        at
>
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
> (ThreadPoolExecutor.java:690)
>        at java.lang.Thread.run(Thread.java:595)
>
> I do wrong again?
>
> Thank you!!!
> Martina
>
>
> gnodet wrote:
> >
> > You should have a look at the existing code:
> >
> >
> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/spring/PublisherComponent.java?r=602828
> >
> > Note that the publisher component actually use the client api (line
> 172).
> > For details on thow the client api works (which is how to send a JBI
> > exchange to the WSN broker), see:
> >
> >
> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/client/NotificationBroker.java?r=602828#l89
> >
> > I would advise you to start from the publisher component, copy it and
> use
> > it
> > instead of your TraceComponent.
> > Each time it receives a JBI exchange, it will publish it through the
> > WSNotification broker.
> >
> > Also look at the various resources on the web site that may help you:
> >   http://servicemix.apache.org/servicemix-wsn2005.html
> >   http://servicemix.apache.org/example-scenario.html
> >
> >
> >
> > On Jan 4, 2008 2:58 PM, martymusk <ma...@email.it> wrote:
> >
> >>
> >> Hy gnodet and thank you very much for your helpfulness,
> >> but I don't understand exactly what I must to do.
> >>
> >> How can I send JBI exchange to the WSN broker directly?
> >> How can I use WSN client api.
> >>
> >> I'm working for a thesis at University of Naples.
> >> My purpose is to study WSN performance.
> >> I've found your WSN implementation very useful for me, but to study
> >> performance, I need exchange was send back.
> >> It is more than a mounth I'm triyng to do this.
> >>
> >> I would be very grateful if you can help me. Otherwise, there are no
> >> problems, I'll keep on study over and over again, hoping I be able to
> >> achieve my purpose.
> >>
> >> Thank you very much.
> >> Martina
> >>
> >>
> >>
> >> gnodet wrote:
> >> >
> >> > I thought I pointed you to the right direction.
> >> > Do not use the PublisherComponent that way: either use it as it is
> >> > intended
> >> > (deploy it as a component onto the lightweight container) or use the
> >> WSN
> >> > client api:
> >> >    wsn.notify(topic, msg)
> >> >
> >> > I'm not sure what you are trying to achieve with your TraceComponent.
> >>  It
> >> > sounds like you want to reimplement the PublisherComponent.  If so,
> you
> >> > should have a look at how it is implemented and patch it.
> >> >
> >> > Also note that both PublisherComponent and the WSN client api are
> just
> >> > sugar, you can send a JBI exchange to the WSN broker directly if you
> >> want.
> >> >
> >> > On Jan 4, 2008 2:13 PM, martymusk <ma...@email.it> wrote:
> >> >
> >> >>
> >> >> My problem is always the same!
> >> >> In wsn-example, after Consumer received an exchange, I'd like it
> send
> >> >> copy
> >> >> of it. But it doesn't happen. :-(
> >> >> I've modified TraceComponent class in the following way, but it
> >> doesn't
> >> >> work
> >> >> fine:
> >> >>
> >> >>
> >> >> package org.apache.servicemix.wsn;
> >> >>
> >> >> import java.io.StringWriter;
> >> >>
> >> >> import javax.jbi.JBIException;
> >> >> import javax.jbi.messaging.ExchangeStatus;
> >> >> import javax.jbi.messaging.MessageExchange;
> >> >> import javax.jbi.messaging.MessagingException;
> >> >> import javax.jbi.messaging.NormalizedMessage;
> >> >> import javax.xml.bind.JAXBContext;
> >> >> import javax.xml.transform.Source;
> >> >> import javax.xml.transform.TransformerException;
> >> >> //import javax.jbi.messaging.InOut;
> >> >>
> >> >> import org.apache.servicemix.jbi.messaging.MessageExchangeImpl;
> >> >> import org.apache.servicemix.jbi.messaging.InOutImpl;
> >> >> import org.apache.commons.logging.Log;
> >> >> import org.apache.commons.logging.LogFactory;
> >> >> import org.apache.servicemix.MessageExchangeListener;
> >> >> import org.apache.servicemix.components.util.ComponentSupport;
> >> >> import org.apache.servicemix.wsn.spring.PublisherComponent;
> >> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
> >> >> import org.apache.servicemix.jbi.jaxp.StringSource;
> >> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
> >> >> import org.apache.servicemix.wsn.client.NotificationBroker;
> >> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
> >> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
> >> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
> >> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
> >> >> import org.w3c.dom.Element;
> >> >>
> >> >>
> >> >> public class TraceComponent extends ComponentSupport implements
> >> >>                MessageExchangeListener {
> >> >>
> >> >>
> >> >>        private Log log = LogFactory.getLog(TraceComponent.class);
> >> >>
> >> >>        private SourceTransformer sourceTransformer = new
> >> >> SourceTransformer();
> >> >>
> >> >>        public Log getLog() {
> >> >>                return log;
> >> >>        }
> >> >>
> >> >>        public void setLog(Log log) {
> >> >>                this.log = log;
> >> >>        }
> >> >>
> >> >>        public SourceTransformer getSourceTransformer() {
> >> >>                return sourceTransformer;
> >> >>        }
> >> >>
> >> >>        public void setSourceTransformer(SourceTransformer
> >> >> sourceTransformer) {
> >> >>                this.sourceTransformer = sourceTransformer;
> >> >>        }
> >> >>
> >> >>
> >> >>        //AGGIUNGO CODICE
> >> >>
> >> >>        PublisherComponent publisher = new PublisherComponent();
> >> >>          private String subscriptionEndpoint = "subscription";
> >> >>          private NotificationBroker wsnBroker;
> >> >>          private String topic;
> >> >>          private String msg;
> >> >>          private boolean demand;
> >> >>          private Subscribe subscription;
> >> >>
> >> >>
> >> >>          public String getTopic() {
> >> >>                return topic;
> >> >>            }
> >> >>
> >> >>            /**
> >> >>             * @param topic The topic to set.
> >> >>             */
> >> >>            public void setTopic(String topic) {
> >> >>               this.topic = topic;
> >> >>            }
> >> >>
> >> >>         public void init() throws JBIException {
> >> >>                super.init();
> >> >>                getContext().activateEndpoint(getService(),
> >> >> subscriptionEndpoint);
> >> >>                 log.info("METODO INIT");
> >> >>                // publisher.init();
> >> >>
> >> >>                 publisher.setTopic(topic);
> >> >>            }
> >> >>
> >> >>            /* (non-Javadoc)
> >> >>             * @see javax.jbi.management.LifeCycleMBean#start()
> >> >>             */
> >> >>            public void start() throws JBIException {
> >> >>
> >> >>                log.info("METODO START");
> >> >>                //publisher.start();
> >> >>                new Thread() {
> >> >>                  public void run() {
> >> >>                       try {
> >> >>                           wsnBroker = new
> >> >> NotificationBroker(getContext());
> >> >>
> >> >>                           String wsaAddress =
> >> >> getService().getNamespaceURI() + "/"
> >> >> + getService().getLocalPart() + "/" + subscriptionEndpoint;
> >> >>
> >> >> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
> >> >>                                                       topic,
> >> >>                                                        demand);
> >> >>                        } catch (Exception e) {
> >> >>                            log.error("Could not create wsn client",
> >> e);
> >> >>                        }
> >> >>                    }
> >> >>                }.start();
> >> >>            }
> >> >>
> >> >>
> >> >>            public void shutDown() throws JBIException {
> >> >>                log.info("METODO SHUTDOWN");
> >> >>            //  publisher.shutDown();
> >> >>               super.shutDown();
> >> >>            }
> >> >>
> >> >>            //FINE CODICE AGGIUNTO
> >> >>
> >> >>        public void onMessageExchange(MessageExchange exchange)
> >> >>                        throws MessagingException {
> >> >>                // lets dump the incoming message
> >> >>                NormalizedMessage message = exchange.getMessage
> ("in");
> >> >>                if (message == null) {
> >> >>                        log.warn("Received null message from
> exchange:
> >> "
> >> +
> >> >> exchange);
> >> >>                } else {
> >> >>                        log.info("Exchange: " + exchange + " received
> >> IN
> >> >> message: "
> >> >>                                        + message);
> >> >>                        try {
> >> >>                                log.info("Body is: "
> >> >>                                                +
> >> >> sourceTransformer.toString(message.getContent()));
> >> >>                        } catch (TransformerException e) {
> >> >>                                log.error("Failed to turn message
> body
> >> >> into
> >> >> text: " + e, e);
> >> >>                        }
> >> >>                }
> >> >>                done(exchange);
> >> >>                log.info("MESSAGGIO RICEVUTO");
> >> >>
> >> >>                log.info("COPIO IL PACCHETTO");
> >> >>
> >> >>                MessageExchange scambio = (MessageExchange)exchange;
> >> >>
> >> >>
> >> >>
> >> >>                log.info("INVIO");
> >> >>
> >> >>          try{
> >> >>
> >> >>                log.info("FASE INVIO");
> >> >>                //publisher.onMessageExchange(scambio);
> >> >>
> >> >>                //AGGIUNGO onMessageExchange
> >> >>
> >> >>                if (exchange.getStatus() != ExchangeStatus.ACTIVE) {
> >> >>                    return;
> >> >>                }
> >> >>                // This is a notification from the WSN broker
> >> >>                if
> >> >>
> >> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
> >> {
> >> >>                    try {
> >> >>                        JAXBContext jaxbContext =
> >> >> JAXBContext.newInstance(Subscribe.class);
> >> >>                        Source src = exchange.getMessage
> >> >> ("in").getContent();
> >> >>                        Object input =
> >> >> jaxbContext.createUnmarshaller().unmarshal(src);
> >> >>                        if (input instanceof Subscribe) {
> >> >>                            subscription = (Subscribe) input;
> >> >>                            SubscribeResponse response = new
> >> >> SubscribeResponse();
> >> >>                            String wsaAddress =
> >> >> getService().getNamespaceURI() +
> >> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
> >> >>
> >> >> response.setSubscriptionReference(AbstractWSAClient.createWSA
> >> >> (wsaAddress));
> >> >>                            StringWriter writer = new StringWriter();
> >> >>                            jaxbContext.createMarshaller
> >> >> ().marshal(response,
> >> >> writer);
> >> >>                            NormalizedMessage out =
> >> exchange.createMessage
> >> >> ();
> >> >>                            out.setContent(new
> >> >> StringSource(writer.toString
> >> >> ()));
> >> >>                            exchange.setMessage(out, "out");
> >> >>                            send(exchange);
> >> >>
> >> >>                        } else if (input instanceof Unsubscribe) {
> >> >>                            subscription = null;
> >> >>                            UnsubscribeResponse response = new
> >> >> UnsubscribeResponse();
> >> >>                            StringWriter writer = new StringWriter();
> >> >>                            jaxbContext.createMarshaller
> >> >> ().marshal(response,
> >> >> writer);
> >> >>                            NormalizedMessage out =
> >> exchange.createMessage
> >> >> ();
> >> >>                            out.setContent(new
> >> >> StringSource(writer.toString
> >> >> ()));
> >> >>                            exchange.setMessage(out, "out");
> >> >>                            send(exchange);
> >> >>
> >> >>
> >> >>                        } else {
> >> >>                            throw new Exception("Unkown request");
> >> >>                        }
> >> >>                    } catch (Exception e) {
> >> >>                        fail(exchange, e);
> >> >>                    }
> >> >>                // This is a notification to publish
> >> >>                }
> >> >>
> >> >>                  else {
> >> >>                    try {
> >> >>
> >> >>                    log.info("SALTA");
> >> >>                        if (!demand || subscription != null) {
> >> >>                                log.info("ENTRO NELL'IF");
> >> >>                           // Element elem = new
> >> >> SourceTransformer().toDOMElement(exchange.getMessage("in"));
> >> >>                            log.info("PRIMA DI WSNBROKER");
> >> >>                            wsnBroker.notify(topic, msg);
> >> >>                            log.info("PRIMA DI DONE");
> >> >>                            getDeliveryChannel().send(exchange);
> >> >>                            log.info("DOPO DI DONE");
> >> >>                        } else {
> >> >>                            log.info("Ingore notification as the
> >> publisher
> >> >> is no
> >> >> subscribers");
> >> >>                        }
> >> >>                    } catch (Exception e) {
> >> >>                        fail(exchange, e);
> >> >>                        }
> >> >>
> >> >>                log.debug("IL PACCHETTO INVIATO E': " + scambio);
> >> >>
> >> >>                  }
> >> >>                //FINE onMessageExchange
> >> >>
> >> >>           } catch(JBIException e){
> >> >>                  log.error("ECCEZIONE GENERATA!");
> >> >>          }
> >> >>
> >> >>      log.info("INVIATO");
> >> >> }
> >> >> }
> >> >>
> >> >>
> >> >> Help me if you can.
> >> >> Thank you very much for your helpfulness...
> >> >>
> >> >> Martina
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> gnodet wrote:
> >> >> >
> >> >> > You should not have to deal nor see the internal state of the
> >> exchange.
> >> >> > If guess you have an exception when trying to send an exchange,
> but
> >> >> this
> >> >> > means that there is a problem in your code.  You should post a
> >> snippet
> >> >> of
> >> >> > your code that is failing so that we can help you.
> >> >> >
> >> >> > On Jan 4, 2008 12:22 PM, martymusk <ma...@email.it> wrote:
> >> >> >
> >> >> >>
> >> >> >> Hy,
> >> >> >> I've a question...
> >> >> >> can I set anywhere Consumer to CAN_SEND?
> >> >> >>
> >> >> >> I hope you can help me.
> >> >> >> Thank you in advance.
> >> >> >>
> >> >> >> Martina
> >> >> >> --
> >> >> >> View this message in context:
> >> >> >>
> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
> >> >> >> Sent from the ServiceMix - User mailing list archive at
> Nabble.com.
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >> > --
> >> >> > Cheers,
> >> >> > Guillaume Nodet
> >> >> > ------------------------
> >> >> > Blog: http://gnodet.blogspot.com/
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >>
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616107.html
> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > Cheers,
> >> > Guillaume Nodet
> >> > ------------------------
> >> > Blog: http://gnodet.blogspot.com/
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616748.html
> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> > ------------------------
> > Blog: http://gnodet.blogspot.com/
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14619757.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: Consumer Can Send

Posted by martymusk <ma...@email.it>.
Thus , I've created a new class "SubscriberComponent" that is a copy of
PublisherComponent. Trhough it instance2 receive exchange and try to send
scambio (copy of exchange). When I run example the following error occurs...

DEBUG - JMSFlow                        - Called Flow send
DEBUG - ActiveMQSession                - Sending message:
ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId =
ID:martina-38529-1199462112612-3:0:1:1:6, originalDestination = null,
originalTransactionId = null, producerId =
ID:martina-38529-1199462112612-3:0:1:1, destination =
queue://org.apache.servicemix.jms.wsn2, transactionId = null, expiration =
0, timestamp = 1199462153935, arrival = 0, correlationId = null, replyTo =
null, persistent = true, type = null, priority = 4, groupID = null,
groupSequence = 0, targetConsumerId = null, compressed = false, userID =
null, content = org.apache.activemq.util.ByteSequence@b2175,
marshalledProperties = null, dataStructure = null, redeliveryCounter = 0,
size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true,
droppable = false}
DEBUG - WSNSpringComponent             - Received exchange: status: Active,
role: consumer
DEBUG - WSNSpringComponent             - Retrieved correlation id: null
INFO  - DeliveryChannelImpl            - DOPO
container.sendExchange(mirror);
INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
INFO  - DeliveryChannelImpl            - TERMINE DI doSend
INFO  - SubscriberComponent            - MESSAGGIO RICEVUTO
INFO  - SubscriberComponent            - COPIO IL PACCHETTO
INFO  - SubscriberComponent            - IL PACCHETTO COPIATO E': InOut[
  id: ID:192.168.0.172-1174583cdf9-2:0
  status: Active
  role: provider
  endpoint: endpoint
  in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify
xmlns:ns2="http://docs.oasis-open.org/wsn/b-2"
xmlns="http://www.w3.org/2005/08/addressing"
xmlns:ns3="http://docs.oasis-open.org/wsrf/bf-2"
xmlns:ns4="http://docs.oasis-open.org/wsn/t-1"><ns2:NotificationMessage><ns2:Topic>sendTopic</ns2:Topic><ns2:Message><timer
xmlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My Example
Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example
Job</fullname><description/><fireTime>Fri Jan 04 16:55:53 CET
2008</fireTime></timer></ns2:Message></ns2:NotificationMessage></ns2:Notify>
]
INFO  - DeliveryChannelImpl            - ENTRO IN doSend
INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
INFO  - DeliveryChannelImpl            - ENTRO NEL TERZO IF
INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
INFO  - MessageExchangeImpl            - ENTRA IN handleSend
INFO  - MessageExchangeImpl            - PRIMA DI ExchangeStatus status =
getStatus()
INFO  - MessageExchangeImpl            - CONTROLLA IL MSG E CAMBIA LO STATO
INFO  - MessageExchangeImpl            - TERMINA handleSend
INFO  - DeliveryChannelImpl            - DOPO DI me.handleSend(sync)
INFO  - DeliveryChannelImpl            - DOPO DI
mirror.setTxState(MessageExchangeImpl.TX_STATE_NONE)
INFO  - DeliveryChannelImpl            - ESCE DALL'IF
DEBUG - JMSFlow                        - Called Flow send
DEBUG - ActiveMQSession                - Sending message:
ActiveMQObjectMessage {commandId = 0, responseRequired = false, messageId =
ID:martina-38529-1199462112612-3:0:1:1:7, originalDestination = null,
originalTransactionId = null, producerId =
ID:martina-38529-1199462112612-3:0:1:1, destination =
queue://org.apache.servicemix.jms.{http://servicemix.org/wsnotification}NotificationBroker:Broker,
transactionId = null, expiration = 0, timestamp = 1199462153952, arrival =
0, correlationId = null, replyTo = null, persistent = true, type = null,
priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
compressed = false, userID = null, content =
org.apache.activemq.util.ByteSequence@779b3e, marshalledProperties = null,
dataStructure = null, redeliveryCounter = 0, size = 0, properties = null,
readOnlyProperties = true, readOnlyBody = true, droppable = false}
INFO  - DeliveryChannelImpl            - DOPO
container.sendExchange(mirror);
INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
INFO  - DeliveryChannelImpl            - RICHIAMO doSend
INFO  - DeliveryChannelImpl            - ENTRO IN doSend
INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
INFO  - MessageExchangeImpl            - ENTRA IN handleSend
INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
INFO  - DeliveryChannelImpl            - ENTRO NEL SEND
INFO  - DeliveryChannelImpl            - IL CANALE NON E' CHIUSO
INFO  - DeliveryChannelImpl            - RICHIAMO doSend
INFO  - DeliveryChannelImpl            - ENTRO IN doSend
INFO  - DeliveryChannelImpl            - ENTRO NEL TRY
INFO  - DeliveryChannelImpl            - RICHIAMA I LISTNERS
INFO  - DeliveryChannelImpl            - HA RICHIAMATO I LISTNERS
INFO  - DeliveryChannelImpl            - PRIMA DEL FOR
DEBUG - DeliveryChannelImpl            - LA LUNGHEZZA E': 0
INFO  - MessageExchangeImpl            - ENTRA IN handleSend
INFO  - DeliveryChannelImpl            - ENTRA NEL FINALLY
ERROR - JMSFlow                        - Caught an exception routing
ExchangePacket: 
javax.jbi.messaging.MessagingException: illegal call to send / sendSync
	at
org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(MessageExchangeImpl.java:581)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:384)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:444)
	at
org.apache.servicemix.components.util.PojoSupport.fail(PojoSupport.java:249)
	at
org.apache.servicemix.wsn.SubscriberComponent.onMessageExchange(SubscriberComponent.java:203)
	at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:621)
	at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
	at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow.access$3(JMSFlow.java:1)
	at org.apache.servicemix.jbi.nmr.flow.jms.JMSFlow$5.run(JMSFlow.java:543)
	at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
	at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
	at java.lang.Thread.run(Thread.java:595)

I do wrong again?

Thank you!!!
Martina


gnodet wrote:
> 
> You should have a look at the existing code:
> 
> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/spring/PublisherComponent.java?r=602828
> 
> Note that the publisher component actually use the client api (line 172).
> For details on thow the client api works (which is how to send a JBI
> exchange to the WSN broker), see:
> 
> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/client/NotificationBroker.java?r=602828#l89
> 
> I would advise you to start from the publisher component, copy it and use
> it
> instead of your TraceComponent.
> Each time it receives a JBI exchange, it will publish it through the
> WSNotification broker.
> 
> Also look at the various resources on the web site that may help you:
>   http://servicemix.apache.org/servicemix-wsn2005.html
>   http://servicemix.apache.org/example-scenario.html
> 
> 
> 
> On Jan 4, 2008 2:58 PM, martymusk <ma...@email.it> wrote:
> 
>>
>> Hy gnodet and thank you very much for your helpfulness,
>> but I don't understand exactly what I must to do.
>>
>> How can I send JBI exchange to the WSN broker directly?
>> How can I use WSN client api.
>>
>> I'm working for a thesis at University of Naples.
>> My purpose is to study WSN performance.
>> I've found your WSN implementation very useful for me, but to study
>> performance, I need exchange was send back.
>> It is more than a mounth I'm triyng to do this.
>>
>> I would be very grateful if you can help me. Otherwise, there are no
>> problems, I'll keep on study over and over again, hoping I be able to
>> achieve my purpose.
>>
>> Thank you very much.
>> Martina
>>
>>
>>
>> gnodet wrote:
>> >
>> > I thought I pointed you to the right direction.
>> > Do not use the PublisherComponent that way: either use it as it is
>> > intended
>> > (deploy it as a component onto the lightweight container) or use the
>> WSN
>> > client api:
>> >    wsn.notify(topic, msg)
>> >
>> > I'm not sure what you are trying to achieve with your TraceComponent.
>>  It
>> > sounds like you want to reimplement the PublisherComponent.  If so, you
>> > should have a look at how it is implemented and patch it.
>> >
>> > Also note that both PublisherComponent and the WSN client api are just
>> > sugar, you can send a JBI exchange to the WSN broker directly if you
>> want.
>> >
>> > On Jan 4, 2008 2:13 PM, martymusk <ma...@email.it> wrote:
>> >
>> >>
>> >> My problem is always the same!
>> >> In wsn-example, after Consumer received an exchange, I'd like it send
>> >> copy
>> >> of it. But it doesn't happen. :-(
>> >> I've modified TraceComponent class in the following way, but it
>> doesn't
>> >> work
>> >> fine:
>> >>
>> >>
>> >> package org.apache.servicemix.wsn;
>> >>
>> >> import java.io.StringWriter;
>> >>
>> >> import javax.jbi.JBIException;
>> >> import javax.jbi.messaging.ExchangeStatus;
>> >> import javax.jbi.messaging.MessageExchange;
>> >> import javax.jbi.messaging.MessagingException;
>> >> import javax.jbi.messaging.NormalizedMessage;
>> >> import javax.xml.bind.JAXBContext;
>> >> import javax.xml.transform.Source;
>> >> import javax.xml.transform.TransformerException;
>> >> //import javax.jbi.messaging.InOut;
>> >>
>> >> import org.apache.servicemix.jbi.messaging.MessageExchangeImpl;
>> >> import org.apache.servicemix.jbi.messaging.InOutImpl;
>> >> import org.apache.commons.logging.Log;
>> >> import org.apache.commons.logging.LogFactory;
>> >> import org.apache.servicemix.MessageExchangeListener;
>> >> import org.apache.servicemix.components.util.ComponentSupport;
>> >> import org.apache.servicemix.wsn.spring.PublisherComponent;
>> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
>> >> import org.apache.servicemix.jbi.jaxp.StringSource;
>> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
>> >> import org.apache.servicemix.wsn.client.NotificationBroker;
>> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
>> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
>> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
>> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
>> >> import org.w3c.dom.Element;
>> >>
>> >>
>> >> public class TraceComponent extends ComponentSupport implements
>> >>                MessageExchangeListener {
>> >>
>> >>
>> >>        private Log log = LogFactory.getLog(TraceComponent.class);
>> >>
>> >>        private SourceTransformer sourceTransformer = new
>> >> SourceTransformer();
>> >>
>> >>        public Log getLog() {
>> >>                return log;
>> >>        }
>> >>
>> >>        public void setLog(Log log) {
>> >>                this.log = log;
>> >>        }
>> >>
>> >>        public SourceTransformer getSourceTransformer() {
>> >>                return sourceTransformer;
>> >>        }
>> >>
>> >>        public void setSourceTransformer(SourceTransformer
>> >> sourceTransformer) {
>> >>                this.sourceTransformer = sourceTransformer;
>> >>        }
>> >>
>> >>
>> >>        //AGGIUNGO CODICE
>> >>
>> >>        PublisherComponent publisher = new PublisherComponent();
>> >>          private String subscriptionEndpoint = "subscription";
>> >>          private NotificationBroker wsnBroker;
>> >>          private String topic;
>> >>          private String msg;
>> >>          private boolean demand;
>> >>          private Subscribe subscription;
>> >>
>> >>
>> >>          public String getTopic() {
>> >>                return topic;
>> >>            }
>> >>
>> >>            /**
>> >>             * @param topic The topic to set.
>> >>             */
>> >>            public void setTopic(String topic) {
>> >>               this.topic = topic;
>> >>            }
>> >>
>> >>         public void init() throws JBIException {
>> >>                super.init();
>> >>                getContext().activateEndpoint(getService(),
>> >> subscriptionEndpoint);
>> >>                 log.info("METODO INIT");
>> >>                // publisher.init();
>> >>
>> >>                 publisher.setTopic(topic);
>> >>            }
>> >>
>> >>            /* (non-Javadoc)
>> >>             * @see javax.jbi.management.LifeCycleMBean#start()
>> >>             */
>> >>            public void start() throws JBIException {
>> >>
>> >>                log.info("METODO START");
>> >>                //publisher.start();
>> >>                new Thread() {
>> >>                  public void run() {
>> >>                       try {
>> >>                           wsnBroker = new
>> >> NotificationBroker(getContext());
>> >>
>> >>                           String wsaAddress =
>> >> getService().getNamespaceURI() + "/"
>> >> + getService().getLocalPart() + "/" + subscriptionEndpoint;
>> >>
>> >> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
>> >>                                                       topic,
>> >>                                                        demand);
>> >>                        } catch (Exception e) {
>> >>                            log.error("Could not create wsn client",
>> e);
>> >>                        }
>> >>                    }
>> >>                }.start();
>> >>            }
>> >>
>> >>
>> >>            public void shutDown() throws JBIException {
>> >>                log.info("METODO SHUTDOWN");
>> >>            //  publisher.shutDown();
>> >>               super.shutDown();
>> >>            }
>> >>
>> >>            //FINE CODICE AGGIUNTO
>> >>
>> >>        public void onMessageExchange(MessageExchange exchange)
>> >>                        throws MessagingException {
>> >>                // lets dump the incoming message
>> >>                NormalizedMessage message = exchange.getMessage("in");
>> >>                if (message == null) {
>> >>                        log.warn("Received null message from exchange:
>> "
>> +
>> >> exchange);
>> >>                } else {
>> >>                        log.info("Exchange: " + exchange + " received
>> IN
>> >> message: "
>> >>                                        + message);
>> >>                        try {
>> >>                                log.info("Body is: "
>> >>                                                +
>> >> sourceTransformer.toString(message.getContent()));
>> >>                        } catch (TransformerException e) {
>> >>                                log.error("Failed to turn message body
>> >> into
>> >> text: " + e, e);
>> >>                        }
>> >>                }
>> >>                done(exchange);
>> >>                log.info("MESSAGGIO RICEVUTO");
>> >>
>> >>                log.info("COPIO IL PACCHETTO");
>> >>
>> >>                MessageExchange scambio = (MessageExchange)exchange;
>> >>
>> >>
>> >>
>> >>                log.info("INVIO");
>> >>
>> >>          try{
>> >>
>> >>                log.info("FASE INVIO");
>> >>                //publisher.onMessageExchange(scambio);
>> >>
>> >>                //AGGIUNGO onMessageExchange
>> >>
>> >>                if (exchange.getStatus() != ExchangeStatus.ACTIVE) {
>> >>                    return;
>> >>                }
>> >>                // This is a notification from the WSN broker
>> >>                if
>> >>
>> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
>> {
>> >>                    try {
>> >>                        JAXBContext jaxbContext =
>> >> JAXBContext.newInstance(Subscribe.class);
>> >>                        Source src = exchange.getMessage
>> >> ("in").getContent();
>> >>                        Object input =
>> >> jaxbContext.createUnmarshaller().unmarshal(src);
>> >>                        if (input instanceof Subscribe) {
>> >>                            subscription = (Subscribe) input;
>> >>                            SubscribeResponse response = new
>> >> SubscribeResponse();
>> >>                            String wsaAddress =
>> >> getService().getNamespaceURI() +
>> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>> >>
>> >> response.setSubscriptionReference(AbstractWSAClient.createWSA
>> >> (wsaAddress));
>> >>                            StringWriter writer = new StringWriter();
>> >>                            jaxbContext.createMarshaller
>> >> ().marshal(response,
>> >> writer);
>> >>                            NormalizedMessage out =
>> exchange.createMessage
>> >> ();
>> >>                            out.setContent(new
>> >> StringSource(writer.toString
>> >> ()));
>> >>                            exchange.setMessage(out, "out");
>> >>                            send(exchange);
>> >>
>> >>                        } else if (input instanceof Unsubscribe) {
>> >>                            subscription = null;
>> >>                            UnsubscribeResponse response = new
>> >> UnsubscribeResponse();
>> >>                            StringWriter writer = new StringWriter();
>> >>                            jaxbContext.createMarshaller
>> >> ().marshal(response,
>> >> writer);
>> >>                            NormalizedMessage out =
>> exchange.createMessage
>> >> ();
>> >>                            out.setContent(new
>> >> StringSource(writer.toString
>> >> ()));
>> >>                            exchange.setMessage(out, "out");
>> >>                            send(exchange);
>> >>
>> >>
>> >>                        } else {
>> >>                            throw new Exception("Unkown request");
>> >>                        }
>> >>                    } catch (Exception e) {
>> >>                        fail(exchange, e);
>> >>                    }
>> >>                // This is a notification to publish
>> >>                }
>> >>
>> >>                  else {
>> >>                    try {
>> >>
>> >>                    log.info("SALTA");
>> >>                        if (!demand || subscription != null) {
>> >>                                log.info("ENTRO NELL'IF");
>> >>                           // Element elem = new
>> >> SourceTransformer().toDOMElement(exchange.getMessage("in"));
>> >>                            log.info("PRIMA DI WSNBROKER");
>> >>                            wsnBroker.notify(topic, msg);
>> >>                            log.info("PRIMA DI DONE");
>> >>                            getDeliveryChannel().send(exchange);
>> >>                            log.info("DOPO DI DONE");
>> >>                        } else {
>> >>                            log.info("Ingore notification as the
>> publisher
>> >> is no
>> >> subscribers");
>> >>                        }
>> >>                    } catch (Exception e) {
>> >>                        fail(exchange, e);
>> >>                        }
>> >>
>> >>                log.debug("IL PACCHETTO INVIATO E': " + scambio);
>> >>
>> >>                  }
>> >>                //FINE onMessageExchange
>> >>
>> >>           } catch(JBIException e){
>> >>                  log.error("ECCEZIONE GENERATA!");
>> >>          }
>> >>
>> >>      log.info("INVIATO");
>> >> }
>> >> }
>> >>
>> >>
>> >> Help me if you can.
>> >> Thank you very much for your helpfulness...
>> >>
>> >> Martina
>> >>
>> >>
>> >>
>> >>
>> >> gnodet wrote:
>> >> >
>> >> > You should not have to deal nor see the internal state of the
>> exchange.
>> >> > If guess you have an exception when trying to send an exchange, but
>> >> this
>> >> > means that there is a problem in your code.  You should post a
>> snippet
>> >> of
>> >> > your code that is failing so that we can help you.
>> >> >
>> >> > On Jan 4, 2008 12:22 PM, martymusk <ma...@email.it> wrote:
>> >> >
>> >> >>
>> >> >> Hy,
>> >> >> I've a question...
>> >> >> can I set anywhere Consumer to CAN_SEND?
>> >> >>
>> >> >> I hope you can help me.
>> >> >> Thank you in advance.
>> >> >>
>> >> >> Martina
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
>> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > Cheers,
>> >> > Guillaume Nodet
>> >> > ------------------------
>> >> > Blog: http://gnodet.blogspot.com/
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616107.html
>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> > Cheers,
>> > Guillaume Nodet
>> > ------------------------
>> > Blog: http://gnodet.blogspot.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616748.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14619757.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Consumer Can Send

Posted by martymusk <ma...@email.it>.
Ok, I try to do this,
but files xml remain unchanged?

Thank you very much!!! :-)

Martina


gnodet wrote:
> 
> You should have a look at the existing code:
> 
> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/spring/PublisherComponent.java?r=602828
> 
> Note that the publisher component actually use the client api (line 172).
> For details on thow the client api works (which is how to send a JBI
> exchange to the WSN broker), see:
> 
> http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/client/NotificationBroker.java?r=602828#l89
> 
> I would advise you to start from the publisher component, copy it and use
> it
> instead of your TraceComponent.
> Each time it receives a JBI exchange, it will publish it through the
> WSNotification broker.
> 
> Also look at the various resources on the web site that may help you:
>   http://servicemix.apache.org/servicemix-wsn2005.html
>   http://servicemix.apache.org/example-scenario.html
> 
> 
> 
> On Jan 4, 2008 2:58 PM, martymusk <ma...@email.it> wrote:
> 
>>
>> Hy gnodet and thank you very much for your helpfulness,
>> but I don't understand exactly what I must to do.
>>
>> How can I send JBI exchange to the WSN broker directly?
>> How can I use WSN client api.
>>
>> I'm working for a thesis at University of Naples.
>> My purpose is to study WSN performance.
>> I've found your WSN implementation very useful for me, but to study
>> performance, I need exchange was send back.
>> It is more than a mounth I'm triyng to do this.
>>
>> I would be very grateful if you can help me. Otherwise, there are no
>> problems, I'll keep on study over and over again, hoping I be able to
>> achieve my purpose.
>>
>> Thank you very much.
>> Martina
>>
>>
>>
>> gnodet wrote:
>> >
>> > I thought I pointed you to the right direction.
>> > Do not use the PublisherComponent that way: either use it as it is
>> > intended
>> > (deploy it as a component onto the lightweight container) or use the
>> WSN
>> > client api:
>> >    wsn.notify(topic, msg)
>> >
>> > I'm not sure what you are trying to achieve with your TraceComponent.
>>  It
>> > sounds like you want to reimplement the PublisherComponent.  If so, you
>> > should have a look at how it is implemented and patch it.
>> >
>> > Also note that both PublisherComponent and the WSN client api are just
>> > sugar, you can send a JBI exchange to the WSN broker directly if you
>> want.
>> >
>> > On Jan 4, 2008 2:13 PM, martymusk <ma...@email.it> wrote:
>> >
>> >>
>> >> My problem is always the same!
>> >> In wsn-example, after Consumer received an exchange, I'd like it send
>> >> copy
>> >> of it. But it doesn't happen. :-(
>> >> I've modified TraceComponent class in the following way, but it
>> doesn't
>> >> work
>> >> fine:
>> >>
>> >>
>> >> package org.apache.servicemix.wsn;
>> >>
>> >> import java.io.StringWriter;
>> >>
>> >> import javax.jbi.JBIException;
>> >> import javax.jbi.messaging.ExchangeStatus;
>> >> import javax.jbi.messaging.MessageExchange;
>> >> import javax.jbi.messaging.MessagingException;
>> >> import javax.jbi.messaging.NormalizedMessage;
>> >> import javax.xml.bind.JAXBContext;
>> >> import javax.xml.transform.Source;
>> >> import javax.xml.transform.TransformerException;
>> >> //import javax.jbi.messaging.InOut;
>> >>
>> >> import org.apache.servicemix.jbi.messaging.MessageExchangeImpl;
>> >> import org.apache.servicemix.jbi.messaging.InOutImpl;
>> >> import org.apache.commons.logging.Log;
>> >> import org.apache.commons.logging.LogFactory;
>> >> import org.apache.servicemix.MessageExchangeListener;
>> >> import org.apache.servicemix.components.util.ComponentSupport;
>> >> import org.apache.servicemix.wsn.spring.PublisherComponent;
>> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
>> >> import org.apache.servicemix.jbi.jaxp.StringSource;
>> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
>> >> import org.apache.servicemix.wsn.client.NotificationBroker;
>> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
>> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
>> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
>> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
>> >> import org.w3c.dom.Element;
>> >>
>> >>
>> >> public class TraceComponent extends ComponentSupport implements
>> >>                MessageExchangeListener {
>> >>
>> >>
>> >>        private Log log = LogFactory.getLog(TraceComponent.class);
>> >>
>> >>        private SourceTransformer sourceTransformer = new
>> >> SourceTransformer();
>> >>
>> >>        public Log getLog() {
>> >>                return log;
>> >>        }
>> >>
>> >>        public void setLog(Log log) {
>> >>                this.log = log;
>> >>        }
>> >>
>> >>        public SourceTransformer getSourceTransformer() {
>> >>                return sourceTransformer;
>> >>        }
>> >>
>> >>        public void setSourceTransformer(SourceTransformer
>> >> sourceTransformer) {
>> >>                this.sourceTransformer = sourceTransformer;
>> >>        }
>> >>
>> >>
>> >>        //AGGIUNGO CODICE
>> >>
>> >>        PublisherComponent publisher = new PublisherComponent();
>> >>          private String subscriptionEndpoint = "subscription";
>> >>          private NotificationBroker wsnBroker;
>> >>          private String topic;
>> >>          private String msg;
>> >>          private boolean demand;
>> >>          private Subscribe subscription;
>> >>
>> >>
>> >>          public String getTopic() {
>> >>                return topic;
>> >>            }
>> >>
>> >>            /**
>> >>             * @param topic The topic to set.
>> >>             */
>> >>            public void setTopic(String topic) {
>> >>               this.topic = topic;
>> >>            }
>> >>
>> >>         public void init() throws JBIException {
>> >>                super.init();
>> >>                getContext().activateEndpoint(getService(),
>> >> subscriptionEndpoint);
>> >>                 log.info("METODO INIT");
>> >>                // publisher.init();
>> >>
>> >>                 publisher.setTopic(topic);
>> >>            }
>> >>
>> >>            /* (non-Javadoc)
>> >>             * @see javax.jbi.management.LifeCycleMBean#start()
>> >>             */
>> >>            public void start() throws JBIException {
>> >>
>> >>                log.info("METODO START");
>> >>                //publisher.start();
>> >>                new Thread() {
>> >>                  public void run() {
>> >>                       try {
>> >>                           wsnBroker = new
>> >> NotificationBroker(getContext());
>> >>
>> >>                           String wsaAddress =
>> >> getService().getNamespaceURI() + "/"
>> >> + getService().getLocalPart() + "/" + subscriptionEndpoint;
>> >>
>> >> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
>> >>                                                       topic,
>> >>                                                        demand);
>> >>                        } catch (Exception e) {
>> >>                            log.error("Could not create wsn client",
>> e);
>> >>                        }
>> >>                    }
>> >>                }.start();
>> >>            }
>> >>
>> >>
>> >>            public void shutDown() throws JBIException {
>> >>                log.info("METODO SHUTDOWN");
>> >>            //  publisher.shutDown();
>> >>               super.shutDown();
>> >>            }
>> >>
>> >>            //FINE CODICE AGGIUNTO
>> >>
>> >>        public void onMessageExchange(MessageExchange exchange)
>> >>                        throws MessagingException {
>> >>                // lets dump the incoming message
>> >>                NormalizedMessage message = exchange.getMessage("in");
>> >>                if (message == null) {
>> >>                        log.warn("Received null message from exchange:
>> "
>> +
>> >> exchange);
>> >>                } else {
>> >>                        log.info("Exchange: " + exchange + " received
>> IN
>> >> message: "
>> >>                                        + message);
>> >>                        try {
>> >>                                log.info("Body is: "
>> >>                                                +
>> >> sourceTransformer.toString(message.getContent()));
>> >>                        } catch (TransformerException e) {
>> >>                                log.error("Failed to turn message body
>> >> into
>> >> text: " + e, e);
>> >>                        }
>> >>                }
>> >>                done(exchange);
>> >>                log.info("MESSAGGIO RICEVUTO");
>> >>
>> >>                log.info("COPIO IL PACCHETTO");
>> >>
>> >>                MessageExchange scambio = (MessageExchange)exchange;
>> >>
>> >>
>> >>
>> >>                log.info("INVIO");
>> >>
>> >>          try{
>> >>
>> >>                log.info("FASE INVIO");
>> >>                //publisher.onMessageExchange(scambio);
>> >>
>> >>                //AGGIUNGO onMessageExchange
>> >>
>> >>                if (exchange.getStatus() != ExchangeStatus.ACTIVE) {
>> >>                    return;
>> >>                }
>> >>                // This is a notification from the WSN broker
>> >>                if
>> >>
>> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
>> {
>> >>                    try {
>> >>                        JAXBContext jaxbContext =
>> >> JAXBContext.newInstance(Subscribe.class);
>> >>                        Source src = exchange.getMessage
>> >> ("in").getContent();
>> >>                        Object input =
>> >> jaxbContext.createUnmarshaller().unmarshal(src);
>> >>                        if (input instanceof Subscribe) {
>> >>                            subscription = (Subscribe) input;
>> >>                            SubscribeResponse response = new
>> >> SubscribeResponse();
>> >>                            String wsaAddress =
>> >> getService().getNamespaceURI() +
>> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>> >>
>> >> response.setSubscriptionReference(AbstractWSAClient.createWSA
>> >> (wsaAddress));
>> >>                            StringWriter writer = new StringWriter();
>> >>                            jaxbContext.createMarshaller
>> >> ().marshal(response,
>> >> writer);
>> >>                            NormalizedMessage out =
>> exchange.createMessage
>> >> ();
>> >>                            out.setContent(new
>> >> StringSource(writer.toString
>> >> ()));
>> >>                            exchange.setMessage(out, "out");
>> >>                            send(exchange);
>> >>
>> >>                        } else if (input instanceof Unsubscribe) {
>> >>                            subscription = null;
>> >>                            UnsubscribeResponse response = new
>> >> UnsubscribeResponse();
>> >>                            StringWriter writer = new StringWriter();
>> >>                            jaxbContext.createMarshaller
>> >> ().marshal(response,
>> >> writer);
>> >>                            NormalizedMessage out =
>> exchange.createMessage
>> >> ();
>> >>                            out.setContent(new
>> >> StringSource(writer.toString
>> >> ()));
>> >>                            exchange.setMessage(out, "out");
>> >>                            send(exchange);
>> >>
>> >>
>> >>                        } else {
>> >>                            throw new Exception("Unkown request");
>> >>                        }
>> >>                    } catch (Exception e) {
>> >>                        fail(exchange, e);
>> >>                    }
>> >>                // This is a notification to publish
>> >>                }
>> >>
>> >>                  else {
>> >>                    try {
>> >>
>> >>                    log.info("SALTA");
>> >>                        if (!demand || subscription != null) {
>> >>                                log.info("ENTRO NELL'IF");
>> >>                           // Element elem = new
>> >> SourceTransformer().toDOMElement(exchange.getMessage("in"));
>> >>                            log.info("PRIMA DI WSNBROKER");
>> >>                            wsnBroker.notify(topic, msg);
>> >>                            log.info("PRIMA DI DONE");
>> >>                            getDeliveryChannel().send(exchange);
>> >>                            log.info("DOPO DI DONE");
>> >>                        } else {
>> >>                            log.info("Ingore notification as the
>> publisher
>> >> is no
>> >> subscribers");
>> >>                        }
>> >>                    } catch (Exception e) {
>> >>                        fail(exchange, e);
>> >>                        }
>> >>
>> >>                log.debug("IL PACCHETTO INVIATO E': " + scambio);
>> >>
>> >>                  }
>> >>                //FINE onMessageExchange
>> >>
>> >>           } catch(JBIException e){
>> >>                  log.error("ECCEZIONE GENERATA!");
>> >>          }
>> >>
>> >>      log.info("INVIATO");
>> >> }
>> >> }
>> >>
>> >>
>> >> Help me if you can.
>> >> Thank you very much for your helpfulness...
>> >>
>> >> Martina
>> >>
>> >>
>> >>
>> >>
>> >> gnodet wrote:
>> >> >
>> >> > You should not have to deal nor see the internal state of the
>> exchange.
>> >> > If guess you have an exception when trying to send an exchange, but
>> >> this
>> >> > means that there is a problem in your code.  You should post a
>> snippet
>> >> of
>> >> > your code that is failing so that we can help you.
>> >> >
>> >> > On Jan 4, 2008 12:22 PM, martymusk <ma...@email.it> wrote:
>> >> >
>> >> >>
>> >> >> Hy,
>> >> >> I've a question...
>> >> >> can I set anywhere Consumer to CAN_SEND?
>> >> >>
>> >> >> I hope you can help me.
>> >> >> Thank you in advance.
>> >> >>
>> >> >> Martina
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
>> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > Cheers,
>> >> > Guillaume Nodet
>> >> > ------------------------
>> >> > Blog: http://gnodet.blogspot.com/
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616107.html
>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> > Cheers,
>> > Guillaume Nodet
>> > ------------------------
>> > Blog: http://gnodet.blogspot.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616748.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14617543.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Consumer Can Send

Posted by Guillaume Nodet <gn...@gmail.com>.
You should have a look at the existing code:

http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/spring/PublisherComponent.java?r=602828

Note that the publisher component actually use the client api (line 172).
For details on thow the client api works (which is how to send a JBI
exchange to the WSN broker), see:

http://fisheye6.cenqua.com/browse/servicemix/smx3/branches/servicemix-3.1/deployables/serviceengines/servicemix-wsn2005/src/main/java/org/apache/servicemix/wsn/client/NotificationBroker.java?r=602828#l89

I would advise you to start from the publisher component, copy it and use it
instead of your TraceComponent.
Each time it receives a JBI exchange, it will publish it through the
WSNotification broker.

Also look at the various resources on the web site that may help you:
  http://servicemix.apache.org/servicemix-wsn2005.html
  http://servicemix.apache.org/example-scenario.html



On Jan 4, 2008 2:58 PM, martymusk <ma...@email.it> wrote:

>
> Hy gnodet and thank you very much for your helpfulness,
> but I don't understand exactly what I must to do.
>
> How can I send JBI exchange to the WSN broker directly?
> How can I use WSN client api.
>
> I'm working for a thesis at University of Naples.
> My purpose is to study WSN performance.
> I've found your WSN implementation very useful for me, but to study
> performance, I need exchange was send back.
> It is more than a mounth I'm triyng to do this.
>
> I would be very grateful if you can help me. Otherwise, there are no
> problems, I'll keep on study over and over again, hoping I be able to
> achieve my purpose.
>
> Thank you very much.
> Martina
>
>
>
> gnodet wrote:
> >
> > I thought I pointed you to the right direction.
> > Do not use the PublisherComponent that way: either use it as it is
> > intended
> > (deploy it as a component onto the lightweight container) or use the WSN
> > client api:
> >    wsn.notify(topic, msg)
> >
> > I'm not sure what you are trying to achieve with your TraceComponent.
>  It
> > sounds like you want to reimplement the PublisherComponent.  If so, you
> > should have a look at how it is implemented and patch it.
> >
> > Also note that both PublisherComponent and the WSN client api are just
> > sugar, you can send a JBI exchange to the WSN broker directly if you
> want.
> >
> > On Jan 4, 2008 2:13 PM, martymusk <ma...@email.it> wrote:
> >
> >>
> >> My problem is always the same!
> >> In wsn-example, after Consumer received an exchange, I'd like it send
> >> copy
> >> of it. But it doesn't happen. :-(
> >> I've modified TraceComponent class in the following way, but it doesn't
> >> work
> >> fine:
> >>
> >>
> >> package org.apache.servicemix.wsn;
> >>
> >> import java.io.StringWriter;
> >>
> >> import javax.jbi.JBIException;
> >> import javax.jbi.messaging.ExchangeStatus;
> >> import javax.jbi.messaging.MessageExchange;
> >> import javax.jbi.messaging.MessagingException;
> >> import javax.jbi.messaging.NormalizedMessage;
> >> import javax.xml.bind.JAXBContext;
> >> import javax.xml.transform.Source;
> >> import javax.xml.transform.TransformerException;
> >> //import javax.jbi.messaging.InOut;
> >>
> >> import org.apache.servicemix.jbi.messaging.MessageExchangeImpl;
> >> import org.apache.servicemix.jbi.messaging.InOutImpl;
> >> import org.apache.commons.logging.Log;
> >> import org.apache.commons.logging.LogFactory;
> >> import org.apache.servicemix.MessageExchangeListener;
> >> import org.apache.servicemix.components.util.ComponentSupport;
> >> import org.apache.servicemix.wsn.spring.PublisherComponent;
> >> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
> >> import org.apache.servicemix.jbi.jaxp.StringSource;
> >> import org.apache.servicemix.wsn.client.AbstractWSAClient;
> >> import org.apache.servicemix.wsn.client.NotificationBroker;
> >> import org.oasis_open.docs.wsn.b_2.Subscribe;
> >> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
> >> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
> >> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
> >> import org.w3c.dom.Element;
> >>
> >>
> >> public class TraceComponent extends ComponentSupport implements
> >>                MessageExchangeListener {
> >>
> >>
> >>        private Log log = LogFactory.getLog(TraceComponent.class);
> >>
> >>        private SourceTransformer sourceTransformer = new
> >> SourceTransformer();
> >>
> >>        public Log getLog() {
> >>                return log;
> >>        }
> >>
> >>        public void setLog(Log log) {
> >>                this.log = log;
> >>        }
> >>
> >>        public SourceTransformer getSourceTransformer() {
> >>                return sourceTransformer;
> >>        }
> >>
> >>        public void setSourceTransformer(SourceTransformer
> >> sourceTransformer) {
> >>                this.sourceTransformer = sourceTransformer;
> >>        }
> >>
> >>
> >>        //AGGIUNGO CODICE
> >>
> >>        PublisherComponent publisher = new PublisherComponent();
> >>          private String subscriptionEndpoint = "subscription";
> >>          private NotificationBroker wsnBroker;
> >>          private String topic;
> >>          private String msg;
> >>          private boolean demand;
> >>          private Subscribe subscription;
> >>
> >>
> >>          public String getTopic() {
> >>                return topic;
> >>            }
> >>
> >>            /**
> >>             * @param topic The topic to set.
> >>             */
> >>            public void setTopic(String topic) {
> >>               this.topic = topic;
> >>            }
> >>
> >>         public void init() throws JBIException {
> >>                super.init();
> >>                getContext().activateEndpoint(getService(),
> >> subscriptionEndpoint);
> >>                 log.info("METODO INIT");
> >>                // publisher.init();
> >>
> >>                 publisher.setTopic(topic);
> >>            }
> >>
> >>            /* (non-Javadoc)
> >>             * @see javax.jbi.management.LifeCycleMBean#start()
> >>             */
> >>            public void start() throws JBIException {
> >>
> >>                log.info("METODO START");
> >>                //publisher.start();
> >>                new Thread() {
> >>                  public void run() {
> >>                       try {
> >>                           wsnBroker = new
> >> NotificationBroker(getContext());
> >>
> >>                           String wsaAddress =
> >> getService().getNamespaceURI() + "/"
> >> + getService().getLocalPart() + "/" + subscriptionEndpoint;
> >>
> >> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
> >>                                                       topic,
> >>                                                        demand);
> >>                        } catch (Exception e) {
> >>                            log.error("Could not create wsn client", e);
> >>                        }
> >>                    }
> >>                }.start();
> >>            }
> >>
> >>
> >>            public void shutDown() throws JBIException {
> >>                log.info("METODO SHUTDOWN");
> >>            //  publisher.shutDown();
> >>               super.shutDown();
> >>            }
> >>
> >>            //FINE CODICE AGGIUNTO
> >>
> >>        public void onMessageExchange(MessageExchange exchange)
> >>                        throws MessagingException {
> >>                // lets dump the incoming message
> >>                NormalizedMessage message = exchange.getMessage("in");
> >>                if (message == null) {
> >>                        log.warn("Received null message from exchange: "
> +
> >> exchange);
> >>                } else {
> >>                        log.info("Exchange: " + exchange + " received IN
> >> message: "
> >>                                        + message);
> >>                        try {
> >>                                log.info("Body is: "
> >>                                                +
> >> sourceTransformer.toString(message.getContent()));
> >>                        } catch (TransformerException e) {
> >>                                log.error("Failed to turn message body
> >> into
> >> text: " + e, e);
> >>                        }
> >>                }
> >>                done(exchange);
> >>                log.info("MESSAGGIO RICEVUTO");
> >>
> >>                log.info("COPIO IL PACCHETTO");
> >>
> >>                MessageExchange scambio = (MessageExchange)exchange;
> >>
> >>
> >>
> >>                log.info("INVIO");
> >>
> >>          try{
> >>
> >>                log.info("FASE INVIO");
> >>                //publisher.onMessageExchange(scambio);
> >>
> >>                //AGGIUNGO onMessageExchange
> >>
> >>                if (exchange.getStatus() != ExchangeStatus.ACTIVE) {
> >>                    return;
> >>                }
> >>                // This is a notification from the WSN broker
> >>                if
> >> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint))
> {
> >>                    try {
> >>                        JAXBContext jaxbContext =
> >> JAXBContext.newInstance(Subscribe.class);
> >>                        Source src = exchange.getMessage
> >> ("in").getContent();
> >>                        Object input =
> >> jaxbContext.createUnmarshaller().unmarshal(src);
> >>                        if (input instanceof Subscribe) {
> >>                            subscription = (Subscribe) input;
> >>                            SubscribeResponse response = new
> >> SubscribeResponse();
> >>                            String wsaAddress =
> >> getService().getNamespaceURI() +
> >> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
> >>
> >> response.setSubscriptionReference(AbstractWSAClient.createWSA
> >> (wsaAddress));
> >>                            StringWriter writer = new StringWriter();
> >>                            jaxbContext.createMarshaller
> >> ().marshal(response,
> >> writer);
> >>                            NormalizedMessage out =
> exchange.createMessage
> >> ();
> >>                            out.setContent(new
> >> StringSource(writer.toString
> >> ()));
> >>                            exchange.setMessage(out, "out");
> >>                            send(exchange);
> >>
> >>                        } else if (input instanceof Unsubscribe) {
> >>                            subscription = null;
> >>                            UnsubscribeResponse response = new
> >> UnsubscribeResponse();
> >>                            StringWriter writer = new StringWriter();
> >>                            jaxbContext.createMarshaller
> >> ().marshal(response,
> >> writer);
> >>                            NormalizedMessage out =
> exchange.createMessage
> >> ();
> >>                            out.setContent(new
> >> StringSource(writer.toString
> >> ()));
> >>                            exchange.setMessage(out, "out");
> >>                            send(exchange);
> >>
> >>
> >>                        } else {
> >>                            throw new Exception("Unkown request");
> >>                        }
> >>                    } catch (Exception e) {
> >>                        fail(exchange, e);
> >>                    }
> >>                // This is a notification to publish
> >>                }
> >>
> >>                  else {
> >>                    try {
> >>
> >>                    log.info("SALTA");
> >>                        if (!demand || subscription != null) {
> >>                                log.info("ENTRO NELL'IF");
> >>                           // Element elem = new
> >> SourceTransformer().toDOMElement(exchange.getMessage("in"));
> >>                            log.info("PRIMA DI WSNBROKER");
> >>                            wsnBroker.notify(topic, msg);
> >>                            log.info("PRIMA DI DONE");
> >>                            getDeliveryChannel().send(exchange);
> >>                            log.info("DOPO DI DONE");
> >>                        } else {
> >>                            log.info("Ingore notification as the
> publisher
> >> is no
> >> subscribers");
> >>                        }
> >>                    } catch (Exception e) {
> >>                        fail(exchange, e);
> >>                        }
> >>
> >>                log.debug("IL PACCHETTO INVIATO E': " + scambio);
> >>
> >>                  }
> >>                //FINE onMessageExchange
> >>
> >>           } catch(JBIException e){
> >>                  log.error("ECCEZIONE GENERATA!");
> >>          }
> >>
> >>      log.info("INVIATO");
> >> }
> >> }
> >>
> >>
> >> Help me if you can.
> >> Thank you very much for your helpfulness...
> >>
> >> Martina
> >>
> >>
> >>
> >>
> >> gnodet wrote:
> >> >
> >> > You should not have to deal nor see the internal state of the
> exchange.
> >> > If guess you have an exception when trying to send an exchange, but
> >> this
> >> > means that there is a problem in your code.  You should post a
> snippet
> >> of
> >> > your code that is failing so that we can help you.
> >> >
> >> > On Jan 4, 2008 12:22 PM, martymusk <ma...@email.it> wrote:
> >> >
> >> >>
> >> >> Hy,
> >> >> I've a question...
> >> >> can I set anywhere Consumer to CAN_SEND?
> >> >>
> >> >> I hope you can help me.
> >> >> Thank you in advance.
> >> >>
> >> >> Martina
> >> >> --
> >> >> View this message in context:
> >> >>
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > Cheers,
> >> > Guillaume Nodet
> >> > ------------------------
> >> > Blog: http://gnodet.blogspot.com/
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616107.html
> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> > ------------------------
> > Blog: http://gnodet.blogspot.com/
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616748.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: Consumer Can Send

Posted by martymusk <ma...@email.it>.
Hy gnodet and thank you very much for your helpfulness,
but I don't understand exactly what I must to do.

How can I send JBI exchange to the WSN broker directly?
How can I use WSN client api.

I'm working for a thesis at University of Naples.
My purpose is to study WSN performance.
I've found your WSN implementation very useful for me, but to study
performance, I need exchange was send back.
It is more than a mounth I'm triyng to do this.

I would be very grateful if you can help me. Otherwise, there are no
problems, I'll keep on study over and over again, hoping I be able to
achieve my purpose.

Thank you very much.
Martina



gnodet wrote:
> 
> I thought I pointed you to the right direction.
> Do not use the PublisherComponent that way: either use it as it is
> intended
> (deploy it as a component onto the lightweight container) or use the WSN
> client api:
>    wsn.notify(topic, msg)
> 
> I'm not sure what you are trying to achieve with your TraceComponent.  It
> sounds like you want to reimplement the PublisherComponent.  If so, you
> should have a look at how it is implemented and patch it.
> 
> Also note that both PublisherComponent and the WSN client api are just
> sugar, you can send a JBI exchange to the WSN broker directly if you want.
> 
> On Jan 4, 2008 2:13 PM, martymusk <ma...@email.it> wrote:
> 
>>
>> My problem is always the same!
>> In wsn-example, after Consumer received an exchange, I'd like it send
>> copy
>> of it. But it doesn't happen. :-(
>> I've modified TraceComponent class in the following way, but it doesn't
>> work
>> fine:
>>
>>
>> package org.apache.servicemix.wsn;
>>
>> import java.io.StringWriter;
>>
>> import javax.jbi.JBIException;
>> import javax.jbi.messaging.ExchangeStatus;
>> import javax.jbi.messaging.MessageExchange;
>> import javax.jbi.messaging.MessagingException;
>> import javax.jbi.messaging.NormalizedMessage;
>> import javax.xml.bind.JAXBContext;
>> import javax.xml.transform.Source;
>> import javax.xml.transform.TransformerException;
>> //import javax.jbi.messaging.InOut;
>>
>> import org.apache.servicemix.jbi.messaging.MessageExchangeImpl;
>> import org.apache.servicemix.jbi.messaging.InOutImpl;
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>> import org.apache.servicemix.MessageExchangeListener;
>> import org.apache.servicemix.components.util.ComponentSupport;
>> import org.apache.servicemix.wsn.spring.PublisherComponent;
>> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
>> import org.apache.servicemix.jbi.jaxp.StringSource;
>> import org.apache.servicemix.wsn.client.AbstractWSAClient;
>> import org.apache.servicemix.wsn.client.NotificationBroker;
>> import org.oasis_open.docs.wsn.b_2.Subscribe;
>> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
>> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
>> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
>> import org.w3c.dom.Element;
>>
>>
>> public class TraceComponent extends ComponentSupport implements
>>                MessageExchangeListener {
>>
>>
>>        private Log log = LogFactory.getLog(TraceComponent.class);
>>
>>        private SourceTransformer sourceTransformer = new
>> SourceTransformer();
>>
>>        public Log getLog() {
>>                return log;
>>        }
>>
>>        public void setLog(Log log) {
>>                this.log = log;
>>        }
>>
>>        public SourceTransformer getSourceTransformer() {
>>                return sourceTransformer;
>>        }
>>
>>        public void setSourceTransformer(SourceTransformer
>> sourceTransformer) {
>>                this.sourceTransformer = sourceTransformer;
>>        }
>>
>>
>>        //AGGIUNGO CODICE
>>
>>        PublisherComponent publisher = new PublisherComponent();
>>          private String subscriptionEndpoint = "subscription";
>>          private NotificationBroker wsnBroker;
>>          private String topic;
>>          private String msg;
>>          private boolean demand;
>>          private Subscribe subscription;
>>
>>
>>          public String getTopic() {
>>                return topic;
>>            }
>>
>>            /**
>>             * @param topic The topic to set.
>>             */
>>            public void setTopic(String topic) {
>>               this.topic = topic;
>>            }
>>
>>         public void init() throws JBIException {
>>                super.init();
>>                getContext().activateEndpoint(getService(),
>> subscriptionEndpoint);
>>                 log.info("METODO INIT");
>>                // publisher.init();
>>
>>                 publisher.setTopic(topic);
>>            }
>>
>>            /* (non-Javadoc)
>>             * @see javax.jbi.management.LifeCycleMBean#start()
>>             */
>>            public void start() throws JBIException {
>>
>>                log.info("METODO START");
>>                //publisher.start();
>>                new Thread() {
>>                  public void run() {
>>                       try {
>>                           wsnBroker = new
>> NotificationBroker(getContext());
>>
>>                           String wsaAddress =
>> getService().getNamespaceURI() + "/"
>> + getService().getLocalPart() + "/" + subscriptionEndpoint;
>>
>> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
>>                                                       topic,
>>                                                        demand);
>>                        } catch (Exception e) {
>>                            log.error("Could not create wsn client", e);
>>                        }
>>                    }
>>                }.start();
>>            }
>>
>>
>>            public void shutDown() throws JBIException {
>>                log.info("METODO SHUTDOWN");
>>            //  publisher.shutDown();
>>               super.shutDown();
>>            }
>>
>>            //FINE CODICE AGGIUNTO
>>
>>        public void onMessageExchange(MessageExchange exchange)
>>                        throws MessagingException {
>>                // lets dump the incoming message
>>                NormalizedMessage message = exchange.getMessage("in");
>>                if (message == null) {
>>                        log.warn("Received null message from exchange: " +
>> exchange);
>>                } else {
>>                        log.info("Exchange: " + exchange + " received IN
>> message: "
>>                                        + message);
>>                        try {
>>                                log.info("Body is: "
>>                                                +
>> sourceTransformer.toString(message.getContent()));
>>                        } catch (TransformerException e) {
>>                                log.error("Failed to turn message body
>> into
>> text: " + e, e);
>>                        }
>>                }
>>                done(exchange);
>>                log.info("MESSAGGIO RICEVUTO");
>>
>>                log.info("COPIO IL PACCHETTO");
>>
>>                MessageExchange scambio = (MessageExchange)exchange;
>>
>>
>>
>>                log.info("INVIO");
>>
>>          try{
>>
>>                log.info("FASE INVIO");
>>                //publisher.onMessageExchange(scambio);
>>
>>                //AGGIUNGO onMessageExchange
>>
>>                if (exchange.getStatus() != ExchangeStatus.ACTIVE) {
>>                    return;
>>                }
>>                // This is a notification from the WSN broker
>>                if
>> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint)) {
>>                    try {
>>                        JAXBContext jaxbContext =
>> JAXBContext.newInstance(Subscribe.class);
>>                        Source src = exchange.getMessage
>> ("in").getContent();
>>                        Object input =
>> jaxbContext.createUnmarshaller().unmarshal(src);
>>                        if (input instanceof Subscribe) {
>>                            subscription = (Subscribe) input;
>>                            SubscribeResponse response = new
>> SubscribeResponse();
>>                            String wsaAddress =
>> getService().getNamespaceURI() +
>> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>>
>> response.setSubscriptionReference(AbstractWSAClient.createWSA
>> (wsaAddress));
>>                            StringWriter writer = new StringWriter();
>>                            jaxbContext.createMarshaller
>> ().marshal(response,
>> writer);
>>                            NormalizedMessage out = exchange.createMessage
>> ();
>>                            out.setContent(new
>> StringSource(writer.toString
>> ()));
>>                            exchange.setMessage(out, "out");
>>                            send(exchange);
>>
>>                        } else if (input instanceof Unsubscribe) {
>>                            subscription = null;
>>                            UnsubscribeResponse response = new
>> UnsubscribeResponse();
>>                            StringWriter writer = new StringWriter();
>>                            jaxbContext.createMarshaller
>> ().marshal(response,
>> writer);
>>                            NormalizedMessage out = exchange.createMessage
>> ();
>>                            out.setContent(new
>> StringSource(writer.toString
>> ()));
>>                            exchange.setMessage(out, "out");
>>                            send(exchange);
>>
>>
>>                        } else {
>>                            throw new Exception("Unkown request");
>>                        }
>>                    } catch (Exception e) {
>>                        fail(exchange, e);
>>                    }
>>                // This is a notification to publish
>>                }
>>
>>                  else {
>>                    try {
>>
>>                    log.info("SALTA");
>>                        if (!demand || subscription != null) {
>>                                log.info("ENTRO NELL'IF");
>>                           // Element elem = new
>> SourceTransformer().toDOMElement(exchange.getMessage("in"));
>>                            log.info("PRIMA DI WSNBROKER");
>>                            wsnBroker.notify(topic, msg);
>>                            log.info("PRIMA DI DONE");
>>                            getDeliveryChannel().send(exchange);
>>                            log.info("DOPO DI DONE");
>>                        } else {
>>                            log.info("Ingore notification as the publisher
>> is no
>> subscribers");
>>                        }
>>                    } catch (Exception e) {
>>                        fail(exchange, e);
>>                        }
>>
>>                log.debug("IL PACCHETTO INVIATO E': " + scambio);
>>
>>                  }
>>                //FINE onMessageExchange
>>
>>           } catch(JBIException e){
>>                  log.error("ECCEZIONE GENERATA!");
>>          }
>>
>>      log.info("INVIATO");
>> }
>> }
>>
>>
>> Help me if you can.
>> Thank you very much for your helpfulness...
>>
>> Martina
>>
>>
>>
>>
>> gnodet wrote:
>> >
>> > You should not have to deal nor see the internal state of the exchange.
>> > If guess you have an exception when trying to send an exchange, but
>> this
>> > means that there is a problem in your code.  You should post a snippet
>> of
>> > your code that is failing so that we can help you.
>> >
>> > On Jan 4, 2008 12:22 PM, martymusk <ma...@email.it> wrote:
>> >
>> >>
>> >> Hy,
>> >> I've a question...
>> >> can I set anywhere Consumer to CAN_SEND?
>> >>
>> >> I hope you can help me.
>> >> Thank you in advance.
>> >>
>> >> Martina
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> > Cheers,
>> > Guillaume Nodet
>> > ------------------------
>> > Blog: http://gnodet.blogspot.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616107.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616748.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Consumer Can Send

Posted by Guillaume Nodet <gn...@gmail.com>.
I thought I pointed you to the right direction.
Do not use the PublisherComponent that way: either use it as it is intended
(deploy it as a component onto the lightweight container) or use the WSN
client api:
   wsn.notify(topic, msg)

I'm not sure what you are trying to achieve with your TraceComponent.  It
sounds like you want to reimplement the PublisherComponent.  If so, you
should have a look at how it is implemented and patch it.

Also note that both PublisherComponent and the WSN client api are just
sugar, you can send a JBI exchange to the WSN broker directly if you want.

On Jan 4, 2008 2:13 PM, martymusk <ma...@email.it> wrote:

>
> My problem is always the same!
> In wsn-example, after Consumer received an exchange, I'd like it send copy
> of it. But it doesn't happen. :-(
> I've modified TraceComponent class in the following way, but it doesn't
> work
> fine:
>
>
> package org.apache.servicemix.wsn;
>
> import java.io.StringWriter;
>
> import javax.jbi.JBIException;
> import javax.jbi.messaging.ExchangeStatus;
> import javax.jbi.messaging.MessageExchange;
> import javax.jbi.messaging.MessagingException;
> import javax.jbi.messaging.NormalizedMessage;
> import javax.xml.bind.JAXBContext;
> import javax.xml.transform.Source;
> import javax.xml.transform.TransformerException;
> //import javax.jbi.messaging.InOut;
>
> import org.apache.servicemix.jbi.messaging.MessageExchangeImpl;
> import org.apache.servicemix.jbi.messaging.InOutImpl;
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> import org.apache.servicemix.MessageExchangeListener;
> import org.apache.servicemix.components.util.ComponentSupport;
> import org.apache.servicemix.wsn.spring.PublisherComponent;
> import org.apache.servicemix.jbi.jaxp.SourceTransformer;
> import org.apache.servicemix.jbi.jaxp.StringSource;
> import org.apache.servicemix.wsn.client.AbstractWSAClient;
> import org.apache.servicemix.wsn.client.NotificationBroker;
> import org.oasis_open.docs.wsn.b_2.Subscribe;
> import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
> import org.oasis_open.docs.wsn.b_2.Unsubscribe;
> import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
> import org.w3c.dom.Element;
>
>
> public class TraceComponent extends ComponentSupport implements
>                MessageExchangeListener {
>
>
>        private Log log = LogFactory.getLog(TraceComponent.class);
>
>        private SourceTransformer sourceTransformer = new
> SourceTransformer();
>
>        public Log getLog() {
>                return log;
>        }
>
>        public void setLog(Log log) {
>                this.log = log;
>        }
>
>        public SourceTransformer getSourceTransformer() {
>                return sourceTransformer;
>        }
>
>        public void setSourceTransformer(SourceTransformer
> sourceTransformer) {
>                this.sourceTransformer = sourceTransformer;
>        }
>
>
>        //AGGIUNGO CODICE
>
>        PublisherComponent publisher = new PublisherComponent();
>          private String subscriptionEndpoint = "subscription";
>          private NotificationBroker wsnBroker;
>          private String topic;
>          private String msg;
>          private boolean demand;
>          private Subscribe subscription;
>
>
>          public String getTopic() {
>                return topic;
>            }
>
>            /**
>             * @param topic The topic to set.
>             */
>            public void setTopic(String topic) {
>               this.topic = topic;
>            }
>
>         public void init() throws JBIException {
>                super.init();
>                getContext().activateEndpoint(getService(),
> subscriptionEndpoint);
>                 log.info("METODO INIT");
>                // publisher.init();
>
>                 publisher.setTopic(topic);
>            }
>
>            /* (non-Javadoc)
>             * @see javax.jbi.management.LifeCycleMBean#start()
>             */
>            public void start() throws JBIException {
>
>                log.info("METODO START");
>                //publisher.start();
>                new Thread() {
>                  public void run() {
>                       try {
>                           wsnBroker = new
> NotificationBroker(getContext());
>
>                           String wsaAddress =
> getService().getNamespaceURI() + "/"
> + getService().getLocalPart() + "/" + subscriptionEndpoint;
>
> wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
>                                                       topic,
>                                                        demand);
>                        } catch (Exception e) {
>                            log.error("Could not create wsn client", e);
>                        }
>                    }
>                }.start();
>            }
>
>
>            public void shutDown() throws JBIException {
>                log.info("METODO SHUTDOWN");
>            //  publisher.shutDown();
>               super.shutDown();
>            }
>
>            //FINE CODICE AGGIUNTO
>
>        public void onMessageExchange(MessageExchange exchange)
>                        throws MessagingException {
>                // lets dump the incoming message
>                NormalizedMessage message = exchange.getMessage("in");
>                if (message == null) {
>                        log.warn("Received null message from exchange: " +
> exchange);
>                } else {
>                        log.info("Exchange: " + exchange + " received IN
> message: "
>                                        + message);
>                        try {
>                                log.info("Body is: "
>                                                +
> sourceTransformer.toString(message.getContent()));
>                        } catch (TransformerException e) {
>                                log.error("Failed to turn message body into
> text: " + e, e);
>                        }
>                }
>                done(exchange);
>                log.info("MESSAGGIO RICEVUTO");
>
>                log.info("COPIO IL PACCHETTO");
>
>                MessageExchange scambio = (MessageExchange)exchange;
>
>
>
>                log.info("INVIO");
>
>          try{
>
>                log.info("FASE INVIO");
>                //publisher.onMessageExchange(scambio);
>
>                //AGGIUNGO onMessageExchange
>
>                if (exchange.getStatus() != ExchangeStatus.ACTIVE) {
>                    return;
>                }
>                // This is a notification from the WSN broker
>                if
> (exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint)) {
>                    try {
>                        JAXBContext jaxbContext =
> JAXBContext.newInstance(Subscribe.class);
>                        Source src = exchange.getMessage
> ("in").getContent();
>                        Object input =
> jaxbContext.createUnmarshaller().unmarshal(src);
>                        if (input instanceof Subscribe) {
>                            subscription = (Subscribe) input;
>                            SubscribeResponse response = new
> SubscribeResponse();
>                            String wsaAddress =
> getService().getNamespaceURI() +
> "/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
>
> response.setSubscriptionReference(AbstractWSAClient.createWSA
> (wsaAddress));
>                            StringWriter writer = new StringWriter();
>                            jaxbContext.createMarshaller
> ().marshal(response,
> writer);
>                            NormalizedMessage out = exchange.createMessage
> ();
>                            out.setContent(new StringSource(writer.toString
> ()));
>                            exchange.setMessage(out, "out");
>                            send(exchange);
>
>                        } else if (input instanceof Unsubscribe) {
>                            subscription = null;
>                            UnsubscribeResponse response = new
> UnsubscribeResponse();
>                            StringWriter writer = new StringWriter();
>                            jaxbContext.createMarshaller
> ().marshal(response,
> writer);
>                            NormalizedMessage out = exchange.createMessage
> ();
>                            out.setContent(new StringSource(writer.toString
> ()));
>                            exchange.setMessage(out, "out");
>                            send(exchange);
>
>
>                        } else {
>                            throw new Exception("Unkown request");
>                        }
>                    } catch (Exception e) {
>                        fail(exchange, e);
>                    }
>                // This is a notification to publish
>                }
>
>                  else {
>                    try {
>
>                    log.info("SALTA");
>                        if (!demand || subscription != null) {
>                                log.info("ENTRO NELL'IF");
>                           // Element elem = new
> SourceTransformer().toDOMElement(exchange.getMessage("in"));
>                            log.info("PRIMA DI WSNBROKER");
>                            wsnBroker.notify(topic, msg);
>                            log.info("PRIMA DI DONE");
>                            getDeliveryChannel().send(exchange);
>                            log.info("DOPO DI DONE");
>                        } else {
>                            log.info("Ingore notification as the publisher
> is no
> subscribers");
>                        }
>                    } catch (Exception e) {
>                        fail(exchange, e);
>                        }
>
>                log.debug("IL PACCHETTO INVIATO E': " + scambio);
>
>                  }
>                //FINE onMessageExchange
>
>           } catch(JBIException e){
>                  log.error("ECCEZIONE GENERATA!");
>          }
>
>      log.info("INVIATO");
> }
> }
>
>
> Help me if you can.
> Thank you very much for your helpfulness...
>
> Martina
>
>
>
>
> gnodet wrote:
> >
> > You should not have to deal nor see the internal state of the exchange.
> > If guess you have an exception when trying to send an exchange, but this
> > means that there is a problem in your code.  You should post a snippet
> of
> > your code that is failing so that we can help you.
> >
> > On Jan 4, 2008 12:22 PM, martymusk <ma...@email.it> wrote:
> >
> >>
> >> Hy,
> >> I've a question...
> >> can I set anywhere Consumer to CAN_SEND?
> >>
> >> I hope you can help me.
> >> Thank you in advance.
> >>
> >> Martina
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> > ------------------------
> > Blog: http://gnodet.blogspot.com/
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616107.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Re: Consumer Can Send

Posted by martymusk <ma...@email.it>.
My problem is always the same!
In wsn-example, after Consumer received an exchange, I'd like it send copy
of it. But it doesn't happen. :-(
I've modified TraceComponent class in the following way, but it doesn't work
fine:


package org.apache.servicemix.wsn;

import java.io.StringWriter;

import javax.jbi.JBIException;
import javax.jbi.messaging.ExchangeStatus;
import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.MessagingException;
import javax.jbi.messaging.NormalizedMessage;
import javax.xml.bind.JAXBContext;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
//import javax.jbi.messaging.InOut;

import org.apache.servicemix.jbi.messaging.MessageExchangeImpl;
import org.apache.servicemix.jbi.messaging.InOutImpl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.MessageExchangeListener;
import org.apache.servicemix.components.util.ComponentSupport;
import org.apache.servicemix.wsn.spring.PublisherComponent;
import org.apache.servicemix.jbi.jaxp.SourceTransformer;
import org.apache.servicemix.jbi.jaxp.StringSource;
import org.apache.servicemix.wsn.client.AbstractWSAClient;
import org.apache.servicemix.wsn.client.NotificationBroker;
import org.oasis_open.docs.wsn.b_2.Subscribe;
import org.oasis_open.docs.wsn.b_2.SubscribeResponse;
import org.oasis_open.docs.wsn.b_2.Unsubscribe;
import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse;
import org.w3c.dom.Element;


public class TraceComponent extends ComponentSupport implements
		MessageExchangeListener {

	
	private Log log = LogFactory.getLog(TraceComponent.class);

	private SourceTransformer sourceTransformer = new SourceTransformer();

	public Log getLog() {
		return log;
	}

	public void setLog(Log log) {
		this.log = log;
	}

	public SourceTransformer getSourceTransformer() {
		return sourceTransformer;
	}

	public void setSourceTransformer(SourceTransformer sourceTransformer) {
		this.sourceTransformer = sourceTransformer;
	}
	
	
	//AGGIUNGO CODICE
		
	PublisherComponent publisher = new PublisherComponent();
	  private String subscriptionEndpoint = "subscription";
	  private NotificationBroker wsnBroker;
	  private String topic;
	  private String msg;
	  private boolean demand;
	  private Subscribe subscription;
	  
	  
	  public String getTopic() {
	        return topic;
	    }

	    /**
	     * @param topic The topic to set.
	     */
	    public void setTopic(String topic) {
	       this.topic = topic;
	    }
	  
	 public void init() throws JBIException {
	        super.init();
	        getContext().activateEndpoint(getService(), subscriptionEndpoint);
		 log.info("METODO INIT");
		// publisher.init();
		 
		 publisher.setTopic(topic);
	    }
	    
	    /* (non-Javadoc)
	     * @see javax.jbi.management.LifeCycleMBean#start()
	     */
	    public void start() throws JBIException {
	    	
	    	log.info("METODO START");
	    	//publisher.start();
	        new Thread() {
	          public void run() {
	               try {
	                   wsnBroker = new NotificationBroker(getContext());
	                  
	                   String wsaAddress = getService().getNamespaceURI() + "/"
+ getService().getLocalPart() + "/" + subscriptionEndpoint;
	                  
wsnBroker.registerPublisher(AbstractWSAClient.createWSA(wsaAddress),
	                                               topic,
	                                                demand);
	                } catch (Exception e) {
	                    log.error("Could not create wsn client", e);
	                }
	            }
	        }.start();
	    }
	    
	    
	    public void shutDown() throws JBIException {
	    	log.info("METODO SHUTDOWN");
	    //	publisher.shutDown();
	       super.shutDown();
	    }
	    
	    //FINE CODICE AGGIUNTO

	public void onMessageExchange(MessageExchange exchange)
			throws MessagingException {
		// lets dump the incoming message
		NormalizedMessage message = exchange.getMessage("in");
		if (message == null) {
			log.warn("Received null message from exchange: " + exchange);
		} else {
			log.info("Exchange: " + exchange + " received IN message: "
					+ message);
			try {
				log.info("Body is: "
						+ sourceTransformer.toString(message.getContent()));
			} catch (TransformerException e) {
				log.error("Failed to turn message body into text: " + e, e);
			}
		}
		done(exchange);
		log.info("MESSAGGIO RICEVUTO");
		
		log.info("COPIO IL PACCHETTO");
		
		MessageExchange scambio = (MessageExchange)exchange;
       
		 
		
		log.info("INVIO");
		
	  try{
		
		log.info("FASE INVIO");
		//publisher.onMessageExchange(scambio);
		
		//AGGIUNGO onMessageExchange
		
	        if (exchange.getStatus() != ExchangeStatus.ACTIVE) {
	            return;
	        }
	        // This is a notification from the WSN broker
	        if
(exchange.getEndpoint().getEndpointName().equals(subscriptionEndpoint)) {
	            try {
	                JAXBContext jaxbContext =
JAXBContext.newInstance(Subscribe.class);
	                Source src = exchange.getMessage("in").getContent();
	                Object input =
jaxbContext.createUnmarshaller().unmarshal(src);
	                if (input instanceof Subscribe) {
	                    subscription = (Subscribe) input;
	                    SubscribeResponse response = new SubscribeResponse();
	                    String wsaAddress = getService().getNamespaceURI() +
"/" + getService().getLocalPart() + "/" + subscriptionEndpoint;
	                   
response.setSubscriptionReference(AbstractWSAClient.createWSA(wsaAddress));
	                    StringWriter writer = new StringWriter();
	                    jaxbContext.createMarshaller().marshal(response,
writer);
	                    NormalizedMessage out = exchange.createMessage();
	                    out.setContent(new StringSource(writer.toString()));
	                    exchange.setMessage(out, "out");
	                    send(exchange);
	               
	                } else if (input instanceof Unsubscribe) {
	                    subscription = null;
	                    UnsubscribeResponse response = new
UnsubscribeResponse();
	                    StringWriter writer = new StringWriter();
	                    jaxbContext.createMarshaller().marshal(response,
writer);
	                    NormalizedMessage out = exchange.createMessage();
	                    out.setContent(new StringSource(writer.toString()));
	                    exchange.setMessage(out, "out");
	                    send(exchange);
	                   
	               
	                } else {
	                    throw new Exception("Unkown request");
	                }
	            } catch (Exception e) {
	                fail(exchange, e);
	            }
	        // This is a notification to publish
	        } 

	          else {
	            try {
	            	
	            log.info("SALTA");
	                if (!demand || subscription != null) {
	                	log.info("ENTRO NELL'IF");
	                   // Element elem = new
SourceTransformer().toDOMElement(exchange.getMessage("in"));
	                    log.info("PRIMA DI WSNBROKER");
	                    wsnBroker.notify(topic, msg); 
	                    log.info("PRIMA DI DONE");
	                    getDeliveryChannel().send(exchange);
	                    log.info("DOPO DI DONE");
	                } else {
	                    log.info("Ingore notification as the publisher is no
subscribers");
	                }
	            } catch (Exception e) {
	                fail(exchange, e);
	                }
		
		log.debug("IL PACCHETTO INVIATO E': " + scambio);
		
	          } 
	        //FINE onMessageExchange
	        
	   } catch(JBIException e){
		  log.error("ECCEZIONE GENERATA!");
	  }
	  
      log.info("INVIATO");
}
}


Help me if you can.
Thank you very much for your helpfulness...

Martina




gnodet wrote:
> 
> You should not have to deal nor see the internal state of the exchange.
> If guess you have an exception when trying to send an exchange, but this
> means that there is a problem in your code.  You should post a snippet of
> your code that is failing so that we can help you.
> 
> On Jan 4, 2008 12:22 PM, martymusk <ma...@email.it> wrote:
> 
>>
>> Hy,
>> I've a question...
>> can I set anywhere Consumer to CAN_SEND?
>>
>> I hope you can help me.
>> Thank you in advance.
>>
>> Martina
>> --
>> View this message in context:
>> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> ------------------------
> Blog: http://gnodet.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14616107.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Consumer Can Send

Posted by Guillaume Nodet <gn...@gmail.com>.
You should not have to deal nor see the internal state of the exchange.
If guess you have an exception when trying to send an exchange, but this
means that there is a problem in your code.  You should post a snippet of
your code that is failing so that we can help you.

On Jan 4, 2008 12:22 PM, martymusk <ma...@email.it> wrote:

>
> Hy,
> I've a question...
> can I set anywhere Consumer to CAN_SEND?
>
> I hope you can help me.
> Thank you in advance.
>
> Martina
> --
> View this message in context:
> http://www.nabble.com/Consumer-Can-Send-tp14614543s12049p14614543.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/