2

I have one flow calling another flow via a VM endpoint. The call fails with the exception NoReceiverForEndpointException. The message in the logs is:

There is no receiver registered on connector "connector.VM.mule.default" for endpointUri vm://inner

Does anyone know why? This is Mule 3.3.0 enterprise edition.

Thanks.

The config file:

<mule ...>
    <vm:endpoint name="inner" path="inner" />
    <flow name="inner.flow">
        <inbound-endpoint ref="inner" exchange-pattern="request-response" />
        <logger level="INFO" message="in inner flow" />
    </flow>

    <vm:endpoint name="outer" path="outer" />
    <flow name="outer.flow">
        <inbound-endpoint ref="outer" exchange-pattern="one-way" />
        <logger level="INFO" message="in outer flow" />
        <outbound-endpoint ref="inner" exchange-pattern="request-response" />
    </flow>
</mule>

The test case to exercise it:

import org.junit.Test;
import org.mule.api.MuleException;
import org.mule.module.client.MuleClient;
import org.mule.tck.junit4.FunctionalTestCase;

public class VMEndpointTest extends FunctionalTestCase {

    @Test
    public void innerIsCalled() throws MuleException {
        final MuleClient client = new MuleClient(muleContext);
        client.sendNoReceive("outer", new Object(), null);
    }

    @Override
    protected String getConfigResources() {
        return "test.xml";
    }

}
4

2 回答 2

1

Ah, I figured this on my own:

  1. the outer endpoint is one-way, so I should have used dispatch to send a message to it.
  2. some mechanism is required for the unit test to wait for Mule to process the message in the one-way flow. I introduced a vm endpoint just for that with the accompanying receive call in the Java code.

the config file:

<mule ...>
    <vm:endpoint name="outer" path="outer" />
    <flow name="outer.flow">
        <inbound-endpoint ref="outer" exchange-pattern="one-way" />
        <logger level="INFO" message="in outer flow" />
        <outbound-endpoint ref="inner" exchange-pattern="request-response" />
    </flow>

    <vm:endpoint name="inner" path="inner" />
    <vm:endpoint name="inner.completed" path="inner.completed" />
    <flow name="inner.flow">
        <inbound-endpoint ref="inner" exchange-pattern="request-response" />
        <logger level="INFO" message="in inner flow" />
        <outbound-endpoint ref="inner.ftc" exchange-pattern="request-response" />
        <outbound-endpoint ref="inner.completed" exchange-pattern="one-way" />
    </flow>

    <vm:endpoint name="inner.ftc" path="inner.ftc" />
    <simple-service name="innerFtc" endpoint-ref="inner.ftc">
        <test:component />
    </simple-service>
</mule>

the test case:

package foo;

import static org.junit.Assert.assertEquals;

import org.junit.Test;
import org.mule.module.client.MuleClient;
import org.mule.tck.functional.FunctionalTestComponent;
import org.mule.tck.junit4.FunctionalTestCase;

public class VMEndpointTest extends FunctionalTestCase {

    @Test
    public void innerIsCalled() throws Exception {
        final FunctionalTestComponent ftc = getFunctionalTestComponent("innerFtc");
        final Object object = new Object();
        final MuleClient client = new MuleClient(muleContext);

        client.dispatch("outer", object, null);
        client.request("inner.completed", RECEIVE_TIMEOUT);

        assertEquals(object, ftc.getLastReceivedMessage());
    }

    @Override
    protected String getConfigResources() {
        return "test.xml";
    }

}
于 2012-09-17T16:11:43.323 回答
0

For both the vm endpoints you have to configure with the same name then only it will connect.

于 2017-05-05T09:44:42.433 回答