Frage

I am attempting to send a message to a VM endpoint using the FunctionalTestCase below:

@Test
public void CreateAddToCalendarOptionsApiTest() throws Exception{

    MuleClient client = new MuleClient(muleContext);
    String payload = "foo";
    Map<String, Object> properties = null;
    MuleMessage result = client.send("vm://processActivity",  payload, properties);
    assertEquals("foo Received", result.getPayloadAsString());

}

However, in the flow to be tested there are multiple VM connectors defined, so I am getting a TransportFactoryException stating:

org.mule.transport.service.TransportFactoryException: There are at least 
2 connectors matching protocol "vm", so the connector to use must be 
specified on the endpoint using the 'connector' property/attribute. 
Connectors in your configuration that support "vm" are: inMemoryVMQueue, 
recordDeletedActivityDLQStore, recordPublishedActivityDLQStore, 
recordUpdatedActivityDLQStore, deleteQueuedActivityDLQStore,  
(java.lang.IllegalStateException)

How do I specify that my client.send("vm://processActivity", payload, properties) uses a specific VMConnector?

War es hilfreich?

Lösung

Use a query parameter:

client.send("vm://processActivity?connector=inMemoryVMQueue",  payload, properties);

... replacing inMemoryVMQueue by whatever connector you want to use.

It becomes functionally equivalent to an endpoint property.

Andere Tipps

"vm://test?connector=VM" define like the below in your query path

public void test() throws MuleException{ MuleMessage message = new DefaultMuleMessage("ts",muleContext); MuleMessage reply = muleContext.getClient().send("vm://test?connector=VM", message); }

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top