If you want your SE to act as a consumer, you must either:
 * use sendSync
 * use BaseLifeCycle.sendConsumerExchange

Cheers,
Guillaume Nodet

On 6/1/06, SP Liu <[EMAIL PROTECTED]> wrote:


Hi gnodet!
    I created a standard JBI Component using the package of
servicemix-service-engine without any revision in maven2 directory,then I
wrote two example only for test.
    one using MySpringComponent for sending ME to TestComponent while the
other for receiving ME from TestComponent.The latter can run
successfully,but there is some trouble in the first with "No processor
found".

//the first example's code

public class MySpringComponentAsSenderTest extends TestCase {
        public static final String PAYLOAD = "<payload/>";
        public static final String RESPONSE = "<response/>";

    protected JBIContainer container;
    protected DeliveryChannel channel;
    private MySpringComponent consumer;
    private TestComponent provider;
    private MyEndpoint myEndpoint;

    public static class TestComponent extends ComponentSupport {
        public TestComponent(QName service, String endpoint) {
                super(service, endpoint);
        }
        public DeliveryChannel getChannel() throws MessagingException {
                return getContext().getDeliveryChannel();
        }
    }

    protected void setUp() throws Exception {
        container = new JBIContainer();
        container.setFlowName("st");
        container.init();
        container.start();

        // Create components
        provider = new TestComponent(new QName("receiver"),"endpoint");
        consumer = new MySpringComponent();

        myEndpoint = new MyEndpoint();
        myEndpoint.setService(new QName("sender"));
        myEndpoint.setEndpoint("endpoint");
        consumer.setEndpoints(new MyEndpoint[] {myEndpoint});

        // register components
        container.activateComponent(provider,"provider");
        container.activateComponent(consumer,"consumer");
    }

    public void tearDown() throws Exception {
        if (container != null) {
               container.shutDown();
        }
        container = null;
        }

    public void testMyTraceComponentIsOK() throws Exception {
        // create a MessageExchange
        channel = consumer.getComponentContext().getDeliveryChannel();
        MessageExchangeFactory mef =
channel.createExchangeFactoryForService(new
QName("receiver"));
        InOnly mec = mef.createInOnlyExchange();
        NormalizedMessage m = mec.createMessage();
        m.setContent(new StringSource(PAYLOAD));
        mec.setInMessage(m);
                assertEquals(Role.CONSUMER, mec.getRole());

                //  Send message exchange
                channel.send(mec);


        //  Provider side
        InOnly mep = (InOnly)provider.getChannel().accept(1000L);
        assertNotNull(mep);
        assertEquals(ExchangeStatus.ACTIVE, mep.getStatus());
        assertEquals(Role.PROVIDER, mep.getRole());
        mep.setStatus(ExchangeStatus.DONE);
        provider.getChannel().send(mep);

        }
}

// console
...
2006-06-01 19:14:47,656 [main           ] DEBUG DeliveryChannel
- Sent: MessageExchange[
  id: ID:spliu-1113-1149160485406-3:0
  status: Done
  role: provider
  service: receiver
  endpoint: endpoint
  in: <?xml version="1.0" encoding="UTF-8"?><payload/>
]
2006-06-01 19:14:47,656 [main           ] DEBUG AbstractFlow
- Called Flow send
2006-06-01 19:14:47,656 [main           ] DEBUG AbstractFlow
- Called Flow doRouting
2006-06-01 19:14:47,656 [pool-2-thread-1] DEBUG DeliveryChannel
- Accepting ID:spliu-1113-1149160485406-3:0 in DeliveryChannel{consumer}
2006-06-01 19:14:47,656 [pool-2-thread-1] DEBUG DeliveryChannel
- Accepted: MessageExchange[
  id: ID:spliu-1113-1149160485406-3:0
  status: Done
  role: consumer
  service: receiver
  endpoint: endpoint
  in: <?xml version="1.0" encoding="UTF-8"?><payload/>
]
2006-06-01 19:14:47,671 [main           ] DEBUG MySpringComponent
- Stopping component
2006-06-01 19:14:47,671 [pool-2-thread-2] DEBUG MySpringComponent
- Received exchange: status: Done, role: Consumer
2006-06-01 19:14:47,687 [pool-2-thread-2] ERROR MySpringComponent
- Error processing exchange
[EMAIL PROTECTED]
java.lang.IllegalStateException: No processor found for:
ID:spliu-1113-1149160485406-3:0
        at
org.apache.servicemix.common.BaseLifeCycle.processExchange(
BaseLifeCycle.java:388)
        at org.apache.servicemix.common.BaseLifeCycle$2.run(
BaseLifeCycle.java:241)
        at

edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
(ThreadPoolExecutor.java:650)
        at

edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Unknown Source)


I think because there is no processor is set in ME's Property when sent by
MySpringComponent because we use channel.send(mec) as a common method.Ifwe
use MyEndpoint.send(),it can call the sendConsumerExchange() to set
property
so that ME can get the processor when return.Howerve,it seems to be an odd
way.

In the second example,MySpringComponent as provider to receive ME from
TestComponent, we can call getProcessor() through Endpoint in the
processExchange() of BaseLifeCycle class.
How to solve this problem?Arethere some errors with my program?

SP Liu
--
View this message in context:
http://www.nabble.com/%22No+processor+found%22+error-t1716357.html#a4660805
Sent from the ServiceMix - User forum at Nabble.com.


Reply via email to