I found the problem I believe...

The service component needs to extend ComponentSupport and not
TransformComponent, but most importantly I was using the
JmsServiceComponent in the servicemix.xml instead of
JmsReceiverComponent.

Works like a charm now.

Arjen


On 3/16/07, Thomas TERMIN <[EMAIL PROTECTED]> wrote:
Arjen Wiersma wrote:
> thanks for your answer....
>
> I am now suspecting the actual problem is in the call to the activemq
> instance through the OneWayRequestor... The done() statments renders
> the following error:
>
> InOut[
> [snip]
> ]
> java.lang.IllegalStateException: component is not owner
>
> So, the OneWayRequestor is actually sending an InOut message...
>
> relevant code:
>        factory = new ActiveMQConnectionFactory("tcp://" + targetHost
> + ":61616");
>        inQueue = new ActiveMQQueue(targetQueue);
>
>        requestor =
> OneWayRequestor.newInstance(factory.createConnection(), new
> JmsProducerConfig(), true);
>
> any thoughts?
I guess you do the done on the wrong side what means the not the owner
wanna set the status to done. It is not the same handling for InOut as
for InOnly.

> On 3/15/07, Thomas TERMIN <[EMAIL PROTECTED]> wrote:
>> Arjen Wiersma wrote:
>> > I must say that I do not follow... are you saying that the client that
>> > calls the broker has to mark the exchange as 'done'?
>> >
>> > Looking at the pictures I see that performer of the service marks it
>> > as 'done' where it then passes through the NMR to the invoking service
>> > which completes the cycle... or do I interpert this wrong?
>> That's what I meant for inonly
>>
>> public void processInputRequest(MessageExchange exchange) throws
>> MessagingException {
>>         ...
>>         send(inOnly)
>>         done(exchange)
>> ...
>> }
>>
>> Thomas
>>
>> >
>> > Could you give a small example of  'set the done call for the incoming
>> > request'
>> >
>> > my apologies for my not-understanding :)
>> >
>> > Arjen
>> >
>> > On 3/15/07, Thomas TERMIN <[EMAIL PROTECTED]> wrote:
>> >> For an inonly you have to set the done call for the incoming request.
>> >> Taht should be the right place. There are some nice pictures in the
>> JBI
>> >> spec where you can see how it works.
>> >>
>> >> Arjen Wiersma wrote:
>> >> > I actually tried the done() on serveral places and indeed forgot to
>> >> > copy it into the mail...
>> >> >
>> >> > Setting done directly after the send will cause a component is not
>> >> > owner error. Calling it in the onMessageExchange in the broker
>> causes
>> >> > an illegal send/sendSync error. Calling it in the TransformComponent
>> >> > causes an Could not find route for exchange since the message is
>> still
>> >> > returned to the broker? :S....
>> >> >
>> >> > quite baffeling...
>> >> >
>> >> > On 3/15/07, Thomas TERMIN <[EMAIL PROTECTED]> wrote:
>> >> >> You have to call done() for an Inonly exchange. Or did you
>> forget to
>> >> >> post this?
>> >> >>
>> >> >> Arjen Wiersma wrote:
>> >> >> > Hi all,
>> >> >> >
>> >> >> > I have been working on several components that deal with a
>> >> variety of
>> >> >> > message, both InOut and InOnly. I have been using the SEDA
>> flow and
>> >> >> > used ActiveMQConnectionFactory to connect from our client
>> >> application.
>> >> >> > This works really well for the InOut messages, however with
>> InOnly
>> >> >> > messages I run into issues.
>> >> >> >
>> >> >> > The message arrives nicely at the broker, the broker pushes an
>> >> InOnly
>> >> >> > message to an transformation component that does the required
>> >> business
>> >> >> > logic. However even though it seems to be handled properly, the
>> >> >> > message remains on the queue, and when shutting down
>> servicemix it
>> >> >> > kindly tells me that it doesn't know what to do with the message.
>> >> >> >
>> >> >> > I am pasting some of the code snippets, perhaps I have just
>> made an
>> >> >> > obvious mistake... The su is runs in an lwcontainer... this is an
>> >> very
>> >> >> > simple example to demonstrate the issue...
>> >> >> >
>> >> >> > servicemix.xml from the service unit:
>> >> >> >
>> >> >> > [snip]
>> >> >> > <sm:serviceunit id="jbi">
>> >> >> >    <sm:activationSpecs>
>> >> >> >      <sm:activationSpec componentName="asyncBrokerJmsBinding"
>> >> >> >                         destinationService="lb:async-broker">
>> >> >> >        <sm:component>
>> >> >> >          <bean
>> >> >> > class="org.apache.servicemix.components.jms.JmsServiceComponent">
>> >> >> >            <property name="template">
>> >> >> >              <bean
>> class="org.springframework.jms.core.JmsTemplate">
>> >> >> >                <property name="connectionFactory"
>> >> ref="jmsFactory" />
>> >> >> >                <property name="defaultDestinationName"
>> >> >> > value="async.broker.request" />
>> >> >> >                <property name="pubSubDomain" value="false" />
>> >> >> >              </bean>
>> >> >> >            </property>
>> >> >> >          </bean>
>> >> >> >        </sm:component>
>> >> >> >      </sm:activationSpec>
>> >> >> >
>> >> >> >      <sm:activationSpec componentName="asyncBroker"
>> >> >> >                         service="lb:async-broker">
>> >> >> >        <sm:component>
>> >> >> >          <bean class="com.example.ASyncUserBroker" />
>> >> >> >        </sm:component>
>> >> >> >      </sm:activationSpec>
>> >> >> >
>> >> >> >      <sm:activationSpec componentName="businessService"
>> >> >> >                         service="lb:business-service">
>> >> >> >        <sm:component>
>> >> >> >          <bean class="com.example.PersonalMsgService" />
>> >> >> >        </sm:component>
>> >> >> >      </sm:activationSpec>
>> >> >> >    </sm:activationSpecs>
>> >> >> >  </sm:serviceunit>
>> >> >> >
>> >> >> >  <bean id="jmsFactory"
>> >> >> > class="org.apache.activemq.pool.PooledConnectionFactory">
>> >> >> >    <property name="connectionFactory">
>> >> >> >      <bean class="org.apache.activemq.ActiveMQConnectionFactory">
>> >> >> >        <property name="brokerURL"
>> value="tcp://localhost:61616" />
>> >> >> >      </bean>
>> >> >> >    </property>
>> >> >> >  </bean>
>> >> >> > </beans>
>> >> >> > [snap]
>> >> >> >
>> >> >> > the asyncBroker is extending ComponentSupport and deals with the
>> >> input
>> >> >> > (very simplified)
>> >> >> >
>> >> >> >    public void processInputRequest(MessageExchange exchange)
>> throws
>> >> >> > MessagingException {
>> >> >> >        if (exchange.getStatus() == ExchangeStatus.ACTIVE) {
>> >> >> >            String id = exchange.getExchangeId();
>> >> >> >            LOG.info("Received Broker request with id: " + id);
>> >> >> >
>> >> >> >            // send a message to the profile service
>> >> >> >            InOnly inonly = createInOnlyExchange(qtarget, null,
>> >> null);
>> >> >> >            inonly.setProperty(Constants.PROPERTY_CORRELATION_ID,
>> >> id);
>> >> >> >
>> >> >> >            Set<String> propNames =
>> >> >> > exchange.getMessage("in").getPropertyNames();
>> >> >> >            for (String prop : propNames) {
>> >> >> >                inonly.setProperty(prop,
>> >> >> > exchange.getMessage("in").getProperty(prop));
>> >> >> >            }
>> >> >> >
>> >> >> >            NormalizedMessage msg = inonly.createMessage();
>> >> >> >            inonly.setInMessage(msg);
>> >> >> >
>> >> >> >            send(inonly);
>> >> >> >        }
>> >> >> >    }
>> >> >> >
>> >> >> >    public void onMessageExchange(MessageExchange exchange) throws
>> >> >> > MessagingException {
>> >> >> >        if (exchange.getRole() == Role.PROVIDER) {
>> >> >> >            processInputRequest(exchange);
>> >> >> >        }
>> >> >> >    }
>> >> >> >
>> >> >> > And then there is the businessService which extends the
>> >> >> TransformComponent
>> >> >> >
>> >> >> >    protected boolean transform(MessageExchange exchange,
>> >> >> > NormalizedMessage in, NormalizedMessage out) throws
>> >> MessagingException
>> >> >> > {
>> >> >> >        LOG.debug("FIXME: do something here...");
>> >> >> >
>> >> >> >        return true;
>> >> >> >    }
>> >> >> >
>> >> >> > The client code is also very basic in this example to reproduce:
>> >> >> >
>> >> >> >        factory = new ActiveMQConnectionFactory("tcp://" +
>> targetHost
>> >> >> > + ":61616");
>> >> >> >        inQueue = new ActiveMQQueue(targetQueue);
>> >> >> >
>> >> >> >        requestor =
>> >> >> > OneWayRequestor.newInstance(factory.createConnection(), new
>> >> >> > JmsProducerConfig(), false);
>> >> >> >
>> >> >> >                Message out =
>> >> requestor.getSession().createMapMessage();
>> >> >> >                String string = "hi!";
>> >> >> >                out.setStringProperty("string", string);
>> >> >> >                requestor.send(inQueue, out);
>> >> >> >
>> >> >> >        requestor.close();
>> >> >> >
>> >> >> > any words of advise would be greatly appreciated.
>> >> >> >
>> >> >> > Arjen
>> >> >> >
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Thomas Termin
>> >> >> _______________________________
>> >> >> blue elephant systems GmbH
>> >> >> Wollgrasweg 49
>> >> >> D-70599 Stuttgart
>> >> >>
>> >> >> Tel    :  (+49) 0711 - 45 10 17 676
>> >> >> Fax    :  (+49) 0711 - 45 10 17 573
>> >> >> WWW    :  http://www.blue-elephant-systems.com
>> >> >> Email  :  [EMAIL PROTECTED]
>> >> >>
>> >> >> blue elephant systems GmbH
>> >> >> Firmensitz      : Wollgrasweg 49, D-70599 Stuttgart
>> >> >> Registergericht : Amtsgericht Stuttgart, HRB 24106
>> >> >> Geschäftsführer : Holger Dietrich, Thomas Gentsch, Joachim Hoernle
>> >> >>
>> >> >>
>> >> >
>> >>
>> >>
>> >> --
>> >> Thomas Termin
>> >> _______________________________
>> >> blue elephant systems GmbH
>> >> Wollgrasweg 49
>> >> D-70599 Stuttgart
>> >>
>> >> Tel    :  (+49) 0711 - 45 10 17 676
>> >> Fax    :  (+49) 0711 - 45 10 17 573
>> >> WWW    :  http://www.blue-elephant-systems.com
>> >> Email  :  [EMAIL PROTECTED]
>> >>
>> >> blue elephant systems GmbH
>> >> Firmensitz      : Wollgrasweg 49, D-70599 Stuttgart
>> >> Registergericht : Amtsgericht Stuttgart, HRB 24106
>> >> Geschäftsführer : Holger Dietrich, Thomas Gentsch, Joachim Hoernle
>> >>
>> >>
>> >
>>
>>
>> --
>> Thomas Termin
>> _______________________________
>> blue elephant systems GmbH
>> Wollgrasweg 49
>> D-70599 Stuttgart
>>
>> Tel    :  (+49) 0711 - 45 10 17 676
>> Fax    :  (+49) 0711 - 45 10 17 573
>> WWW    :  http://www.blue-elephant-systems.com
>> Email  :  [EMAIL PROTECTED]
>>
>> blue elephant systems GmbH
>> Firmensitz      : Wollgrasweg 49, D-70599 Stuttgart
>> Registergericht : Amtsgericht Stuttgart, HRB 24106
>> Geschäftsführer : Holger Dietrich, Thomas Gentsch, Joachim Hoernle
>>
>>
>


--
Thomas Termin
_______________________________
blue elephant systems GmbH
Wollgrasweg 49
D-70599 Stuttgart

Tel    :  (+49) 0711 - 45 10 17 676
Fax    :  (+49) 0711 - 45 10 17 573
WWW    :  http://www.blue-elephant-systems.com
Email  :  [EMAIL PROTECTED]

blue elephant systems GmbH
Firmensitz      : Wollgrasweg 49, D-70599 Stuttgart
Registergericht : Amtsgericht Stuttgart, HRB 24106
Geschäftsführer : Holger Dietrich, Thomas Gentsch, Joachim Hoernle


Reply via email to