@Override
 public void testDispatchToOneWayInboundTxOnly() throws Exception {
   MuleClient client = muleContext.getClient();
   client.dispatch("vm://oneway-inboundtx-in", "a", null);
   MuleMessage result = client.request("vm://dead-letter-queue", RECEIVE_TIMEOUT);
   assertNotNull(result);
 }
コード例 #2
0
 public void doTestXml(String endpoint, String xml) throws Exception {
   MuleClient client = muleContext.getClient();
   client.dispatch("in", xml, null);
   MuleMessage response = client.request(endpoint, TIMEOUT * 2);
   assertNotNull(response);
   assertNotNull(response.getPayload());
   assertEquals(xml, response.getPayloadAsString());
 }
コード例 #3
0
 @Test
 public void testNotXml() throws Exception {
   logger.debug("not xml");
   MuleClient client = muleContext.getClient();
   client.dispatch("in", STRING_MESSAGE, null);
   MuleMessage response = client.request("notxml", TIMEOUT);
   assertNotNull(response);
   assertNotNull(response.getPayload());
   assertEquals(STRING_MESSAGE, response.getPayloadAsString());
 }
  @Override
  public void testDispatchToOneWayTx() throws Exception {
    MuleClient client = muleContext.getClient();
    client.dispatch("vm://onewaytx-in", "a", null);

    assertNull(client.request("vm://onewaytx-out", RECEIVE_TIMEOUT));

    // TODO Assert exception strategy was called

  }
  @Override
  public void testDispatchToRequestResponseInboundOneWayOutbound() throws Exception {
    MuleClient client = muleContext.getClient();

    client.dispatch("vm://requestresponse-oneway-in", "a", null);

    // Message never gets to reciever as receiver is not polling the queue
    assertNull(client.request("vm://requestresponse-oneway-out", RECEIVE_TIMEOUT));

    // TODO Assert exception strategy was called

  }
コード例 #6
0
  @Override
  public Object onCall(MuleEventContext eventContext) throws Exception {
    logger.info("Entering onCall .....");
    MuleMessage message = eventContext.getMessage();
    List messageList = (List) message.getPayload();
    logger.info("message.getPayload() => {}", messageList);
    MuleClient client = context.getClient();
    StringBuilder aggregated = new StringBuilder("AGGREGATED [");
    for (int i = 0; i < messageList.size(); i++) {
      String messageType = (String) messageList.get(i);
      MuleMessage muleMessage = new DefaultMuleMessage(messageType, context);
      StringBuilder muleURL = new StringBuilder();
      muleMessage.setOutboundProperty("X", messageType);
      client.dispatch("jms://queue1", muleMessage);

      MuleMessage muleMessage2 = new DefaultMuleMessage(messageType, context);
      muleMessage2.setOutboundProperty("X", messageType);
      MuleMessage result = client.send("jms://queue2", muleMessage2);
      aggregated.append(result.getPayload()).append(",");
    }
    aggregated.append("]");
    logger.info("Aggregated response {}", aggregated);
    return eventContext;
  }
コード例 #7
0
  private void sendMessage(String endpoint) throws Exception {
    MuleClient client = muleContext.getClient();

    client.dispatch(endpoint, "Part 1;Part 2", null);
  }