• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DefaultMuleMessage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.mule.DefaultMuleMessage的典型用法代码示例。如果您正苦于以下问题:Java DefaultMuleMessage类的具体用法?Java DefaultMuleMessage怎么用?Java DefaultMuleMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DefaultMuleMessage类属于org.mule包,在下文中一共展示了DefaultMuleMessage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: handleMessage

import org.mule.DefaultMuleMessage; //导入依赖的package包/类
public void handleMessage(Message message) throws Fault
	{
		DefaultMuleMessage m = (DefaultMuleMessage)message.get("mule.message");
//		String s = (String)m.getAdapter().getProperty("Content-type");
//		if (StringUtils.isNotEmpty(s))
//			message.put(Message.CONTENT_TYPE,s);
		for (Object name : m.getAdapter().getPropertyNames())
			if (((String)name).equalsIgnoreCase("content-type"))
			{
				String s = (String)m.getAdapter().getProperty((String)name,PropertyScope.INBOUND);
				if (StringUtils.isNotBlank(s))
				{
					message.put(Message.CONTENT_TYPE,s);
					break;
				}
			}
	}
 
开发者ID:mprins,项目名称:muleebmsadapter,代码行数:18,代码来源:OracleEbMSContentTypeFixingInInterceptor.java


示例2: testSendToFileEndpoint

import org.mule.DefaultMuleMessage; //导入依赖的package包/类
/**
 * Tests dispatching of a message to a file endpoint.
 */
@Test
public void testSendToFileEndpoint() {
    /* Start the Mule transport service. */
    mServiceUnderTest.start();

    final MuleMessage theMuleMessage =
        new DefaultMuleMessage(TEST_MESSAGE_PAYLOAD, mServiceUnderTest.getMuleContext());
    /* Set name of file to be written to destination directory. */
    theMuleMessage.setProperty("originalFilename", "testfile.txt", PropertyScope.INBOUND);
    final MoverMessage<MuleMessage> theMessage = new MuleMoverMessage(theMuleMessage);

    mServiceUnderTest.dispatch(theMessage, mOutboundFileEndpointUri);

    delay(1000);

    /* Verify outcome. */
    final File[] theDestDirFiles = mTestDestinationDirectory.listFiles();
    Assert.assertEquals("There should be one file in the destination directory", 1, theDestDirFiles.length);
}
 
开发者ID:krizsan,项目名称:message-cowboy,代码行数:23,代码来源:MuleTransportServiceTest.java


示例3: performAndVerifyJmsTest

import org.mule.DefaultMuleMessage; //导入依赖的package包/类
private void performAndVerifyJmsTest() {
    final String theJmsEndpointUri = "jms://queue:muletransportservice.queue";

    final MuleMessage theMuleMessage =
        new DefaultMuleMessage(TEST_MESSAGE_PAYLOAD, mServiceUnderTest.getMuleContext());
    final MoverMessage<MuleMessage> theMessage = new MuleMoverMessage();
    theMessage.setMessage(theMuleMessage);

    mServiceUnderTest.dispatch(theMessage, theJmsEndpointUri);

    delay(1000);

    final MoverMessage<MuleMessage> theReceivedMessage = mServiceUnderTest.receive(theJmsEndpointUri, 5000);

    /* Verify outcome. */
    Assert.assertNotNull("A message should have been received", theReceivedMessage);
    final MuleMessage theReceivedMuleMessage = theReceivedMessage.getMessage();
    Assert.assertNotNull("The received message should contain a payload", theReceivedMessage.getMessage());
    Assert.assertEquals("Payload of message should be unaltered", TEST_MESSAGE_PAYLOAD,
        theReceivedMuleMessage.getPayload());
}
 
开发者ID:krizsan,项目名称:message-cowboy,代码行数:22,代码来源:MuleTransportServiceTest.java


示例4: doSetup

import org.mule.DefaultMuleMessage; //导入依赖的package包/类
@Before
public void doSetup() throws Exception {
	Banana banana = new Banana();
	Kiwi kiwi = new Kiwi();
	
	messageA = new DefaultMuleMessage(null, muleContext);
	messageA.addOutboundAttachment("anInboundAttachment", banana, "application/vnd.mule.banana");
	messageA = messageA.createInboundMessage();
	messageA.addOutboundAttachment("anOutboundAttachment", kiwi, "application/vnd.mule.kiwi");
   	
	messageB = new DefaultMuleMessage(null, muleContext);
	messageB.addOutboundAttachment("anInboundAttachment", banana, "application/vnd.mule.banana");
	messageB = messageB.createInboundMessage();
	messageB.addOutboundAttachment("anOutboundAttachment", kiwi, "application/vnd.mule.kiwi");
	
	messageC = new DefaultMuleMessage(null, muleContext);
}
 
开发者ID:vromero,项目名称:mule-module-hamcrest,代码行数:18,代码来源:SameAttachmentsMatcherTestCase.java


示例5: logNotFound

import org.mule.DefaultMuleMessage; //导入依赖的package包/类
void logNotFound(RequestLine requestLine, MuleContext muleContext) {
    HttpResponse httpResponse = new HttpResponse();
    httpResponse.setStatusLine(requestLine.getHttpVersion(), HttpConstants.SC_NOT_FOUND);

    DefaultMuleMessage message = new DefaultMuleMessage(httpResponse, muleContext);
    message.setInboundProperty(HttpConnector.HTTP_METHOD_PROPERTY, requestLine.getMethod());

    try {
        URI uri = new URI(requestLine.getUri());
        message.setInboundProperty(HttpConnector.HTTP_REQUEST_PATH_PROPERTY, uri.getPath());
        if (hasText(uri.getQuery())) {
            message.setInboundProperty(HttpConnector.HTTP_QUERY_STRING, uri.getQuery());
        }
    } catch (URISyntaxException e) {
        e.printStackTrace(); // we swallow this that should never happen
    }
    accessLogger.log(message);
}
 
开发者ID:greenbird,项目名称:mule-access-log,代码行数:19,代码来源:AccessLoggingHelper.java


示例6: visitAfter

import org.mule.DefaultMuleMessage; //导入依赖的package包/类
@Override
public void visitAfter(SAXElement saxElement, ExecutionContext executionContext) throws SmooksException, IOException {
    try {
        Object xmlElement = executionContext.getBeanContext().getBean(FRAGMENT_BEAN_ID);
        MuleContext muleContext = (MuleContext) executionContext.getBeanContext().getBean(MULE_CONTEXT_BEAN_ID);
        muleContext.getClient().send(sendToUri, new DefaultMuleMessage(xmlElement, muleContext));
    } catch (Exception e) {
        String message = String.format("XmlStreamSplitterComponent visitAfter() exception caught: %s", e.getMessage());
        log.error(message, e);
        throw new RuntimeException(message, e);
    }
}
 
开发者ID:guido-n,项目名称:mule-useful-experiments,代码行数:13,代码来源:XmlStreamSplitterComponent.java


示例7: testMule

import org.mule.DefaultMuleMessage; //导入依赖的package包/类
@Test
public void testMule() throws Exception {
    MuleContext muleContext = new DefaultMuleContextFactory().createMuleContext("mule/mule-standlone-config.xml");
    muleContext.start();
    MuleClient muleClient = new DefaultLocalMuleClient(muleContext);
    Integer days = 5;
    MuleMessage message = muleClient.send("vm://helloMule", new DefaultMuleMessage(days, muleContext));
    assertNotNull(message.getPayload());
    Boolean result = (Boolean) message.getPayload();
    assertTrue(result);
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:12,代码来源:HelloMuleTest.java


示例8: testMuleMaster

import org.mule.DefaultMuleMessage; //导入依赖的package包/类
@Test
public void testMuleMaster() throws Exception {
    MuleContext muleContext = new DefaultMuleContextFactory().createMuleContext("mule/mule-master/mule-master.xml");
    muleContext.start();

    MuleRegistry registry = muleContext.getRegistry();
    RepositoryService repositoryService = (RepositoryService) registry.get("repositoryService");
    repositoryService.createDeployment().addClasspathResource("mule/leaveWithMule.bpmn").deploy();

    MuleClient muleClient = new DefaultLocalMuleClient(muleContext);
    DefaultMuleMessage message = new DefaultMuleMessage("", muleContext);
    Map<String, Object> variableMap = new HashMap<String, Object>();
    variableMap.put("days", 5);
    variableMap.put("processDefinitionKey", "leaveWithMule");
    message.setProperty("createProcessParameters", variableMap , PropertyScope.OUTBOUND);
    MuleMessage responseMessage = muleClient.send("vm://startLeaveProcess", message);
    ProcessInstance processInstance = (ProcessInstance) responseMessage.getPayload();
    assertFalse(processInstance.isEnded());

    TaskService taskService = registry.get("taskService");
    Task task = taskService.createTaskQuery().singleResult();
    assertNotNull(task);
    assertEquals("部门经理审批", task.getName());

    muleContext.stop();
    muleContext.dispose();
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:28,代码来源:ActivitiWithMuleTest.java


示例9: execute

import org.mule.DefaultMuleMessage; //导入依赖的package包/类
public void execute(ActivityExecution execution) throws Exception {
  String endpointUrlValue = this.getStringFromField(this.endpointUrl, execution);
  String languageValue = this.getStringFromField(this.language, execution);
  String payloadExpressionValue = this.getStringFromField(this.payloadExpression, execution);
  String resultVariableValue = this.getStringFromField(this.resultVariable, execution);

  LocalMuleClient client = this.getMuleContext().getClient();

  ScriptingEngines scriptingEngines = Context.getProcessEngineConfiguration().getScriptingEngines();
  Object payload = scriptingEngines.evaluate(payloadExpressionValue, languageValue, execution);

  MuleMessage message = new DefaultMuleMessage(payload, this.getMuleContext());

  switch (this.mep) {
  case REQUEST_RESPONSE:
    MuleMessage resultMessage = client.send(endpointUrlValue, message);
    Object result = resultMessage.getPayload();
    if (resultVariableValue != null) {
      execution.setVariable(resultVariableValue, result);
    }
    break;
  case ONE_WAY:
    client.dispatch(endpointUrlValue, message);
    break;
  default:
    break;
  }

  this.leave(execution);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:31,代码来源:MuleSendActivitiBehavior.java


示例10: aggregate

import org.mule.DefaultMuleMessage; //导入依赖的package包/类
@Override
public MuleEvent aggregate(AggregationContext context) throws MuleException {
	VerificaCreditoResponse resultado = new VerificaCreditoResponse();
	resultado.setCredito(new Credito());

	for (MuleEvent event : context.getEvents()) {
		CreditoMappingStrategyFactory.mapCredito(event.getMessage().getPayload(), resultado.getCredito());
	}

	boolean aprovado = resultado.getCredito().isCasasBahia() && resultado.getCredito().isSerasa() && resultado.getCredito().isSpc();
	resultado.getCredito().setAprovado(aprovado);

	MuleMessage response = new DefaultMuleMessage((Object) resultado, context.getOriginalEvent().getMuleContext());
	return new DefaultMuleEvent(response, context.getOriginalEvent(), context.getOriginalEvent().getSession());
}
 
开发者ID:soaexpert,项目名称:circuitbreaker,代码行数:16,代码来源:VerificacaoCreditoAggregationStrategy.java


示例11: doSetup

import org.mule.DefaultMuleMessage; //导入依赖的package包/类
@Before
public void doSetup() throws Exception {
	messageA = new DefaultMuleMessage(null, muleContext);
   	messageA.setOutboundProperty("aKey", "aValue");
   	
   	messageB = new DefaultMuleMessage(null, muleContext);
   	messageB.setOutboundProperty("aKey", "aValue");
   	
   	messageC = new DefaultMuleMessage(null, muleContext);
   	messageC.setOutboundProperty("weird", "value");
}
 
开发者ID:vromero,项目名称:mule-module-hamcrest,代码行数:12,代码来源:SameAnyTestCase.java


示例12: doSetup

import org.mule.DefaultMuleMessage; //导入依赖的package包/类
@Before
public void doSetup() throws Exception {
	message = new DefaultMuleMessage(null, muleContext);
   	new DefaultMuleEvent(message, MessageExchangePattern.ONE_WAY, getTestService());

   	message.setProperty("aPropertyKey", "aValue", PropertyScope.OUTBOUND);
   	message.setProperty("anInboundKey", "this is a Value", PropertyScope.INBOUND);
   	message.setProperty("anOutboundKey", "this is a Value", PropertyScope.OUTBOUND);
   	message.setProperty("anInvocationaKey", "aValue", PropertyScope.INVOCATION);
   	message.setProperty("aSessionKey", 3, PropertyScope.SESSION);
}
 
开发者ID:vromero,项目名称:mule-module-hamcrest,代码行数:12,代码来源:PropertiesTestCase.java


示例13: doSetup

import org.mule.DefaultMuleMessage; //导入依赖的package包/类
@Before
public void doSetup() throws Exception {
	message = new DefaultMuleMessage(null, muleContext);
	Banana banana = new Banana();
	Orange orange = new Orange();
   	message.addOutboundAttachment("anInboundAttachment", banana, "application/vnd.mule.banana");
	message = message.createInboundMessage();
	message.addOutboundAttachment("anOutboundAttachment", orange, "application/vnd.mule.orange");
}
 
开发者ID:vromero,项目名称:mule-module-hamcrest,代码行数:10,代码来源:AttachmentTestCase.java


示例14: doSetup

import org.mule.DefaultMuleMessage; //导入依赖的package包/类
@Before
public void doSetup() throws Exception {
	message = new DefaultMuleMessage(null, muleContext);
	new DefaultMuleEvent(message, MessageExchangePattern.ONE_WAY, getTestService());
	
	message.setProperty("anInboundKey", "aValue", PropertyScope.INBOUND);
   	message.setProperty("anOutboundKey", "aValue", PropertyScope.OUTBOUND);
   	message.setProperty("anInvocationaKey", "aValue", PropertyScope.INVOCATION);
   	message.setProperty("aSessionKey", "aValue", PropertyScope.SESSION);
}
 
开发者ID:vromero,项目名称:mule-module-hamcrest,代码行数:11,代码来源:PropertyMatcherTestCase.java


示例15: doSetup

import org.mule.DefaultMuleMessage; //导入依赖的package包/类
@Before
public void doSetup() throws Exception {
	message = new DefaultMuleMessage(null, muleContext);
	banana = new Banana();
   	message.addOutboundAttachment("anAttachment", banana, "application/vnd.mule.banana");
   	message = message.createInboundMessage();
   	message.addOutboundAttachment("anOutboundAttachment", banana, "application/vnd.mule.banana");
}
 
开发者ID:vromero,项目名称:mule-module-hamcrest,代码行数:9,代码来源:AttachmentMatcherTestCase.java


示例16: doSetup

import org.mule.DefaultMuleMessage; //导入依赖的package包/类
@Before
public void doSetup() throws Exception {
	messageA = new DefaultMuleMessage(null, muleContext);
   	messageA.setOutboundProperty("aKey", "aValue");
   	
   	messageB = new DefaultMuleMessage(null, muleContext);
   	messageB.setOutboundProperty("aKey", "aValue");
   	
   	messageC = new DefaultMuleMessage(null, muleContext);
   	messageC.setOutboundProperty("weird", "value");
   	
}
 
开发者ID:vromero,项目名称:mule-module-hamcrest,代码行数:13,代码来源:SamePropertiesMatcherTestCase.java


示例17: run

import org.mule.DefaultMuleMessage; //导入依赖的package包/类
public void run()
{
    try
    {
        MuleClient client = muleContext.getClient();
        MuleMessage response = client.send(String.format("tcp://localhost:%d?connector=%s", port, connectorName), new DefaultMuleMessage("", muleContext), 10000);
        result = response.getPayloadAsString();
        logger.info("*******************" + result);
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
}
 
开发者ID:Ricston,项目名称:mule-transport-netty-publisher,代码行数:15,代码来源:NettyPublisherConnectorTest.java


示例18: addProperties_retainedPropertiesAlreadySet_propertiesLeftAsIs

import org.mule.DefaultMuleMessage; //导入依赖的package包/类
@Test
public void addProperties_retainedPropertiesAlreadySet_propertiesLeftAsIs() throws Exception {
    DefaultMuleMessage message = testMessage();
    HashMap<String, Object> initialRetainedProperties = new HashMap<String, Object>();
    message.setInvocationProperty(INITIAL_REQUEST_PROPERTY, initialRetainedProperties);

    retainer.retainRequestProperties(message);
    assertThat(message.getInvocationProperty(INITIAL_REQUEST_PROPERTY), is((Object) initialRetainedProperties));
}
 
开发者ID:greenbird,项目名称:mule-access-log,代码行数:10,代码来源:RequestPropertiesRetainerTest.java


示例19: logWithInboundProperty

import org.mule.DefaultMuleMessage; //导入依赖的package包/类
protected String logWithInboundProperty(String conversionString, String name, Object value) {
    DefaultMuleMessage message = testMessage();
    if (value != null) {
        message.setInboundProperty(name, value);
    }
    return logSpecifierWithDefault(conversionString, message);
}
 
开发者ID:greenbird,项目名称:mule-access-log,代码行数:8,代码来源:AccessLogConverterTestBase.java


示例20: testMessage

import org.mule.DefaultMuleMessage; //导入依赖的package包/类
protected DefaultMuleMessage testMessage() {
    MuleEvent testEvent;
    try {
        testEvent = MuleTestUtils.getTestEvent(NullPayload.getInstance(), new DefaultMuleSession(), context());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    RequestContext.setEvent(testEvent);
    return new DefaultMuleMessage(NullPayload.getInstance(), muleContext);
}
 
开发者ID:greenbird,项目名称:mule-access-log,代码行数:11,代码来源:AccessLogConverterTestBase.java



注:本文中的org.mule.DefaultMuleMessage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ServiceManager类代码示例发布时间:2022-05-21
下一篇:
Java CommitCommand类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap