Tag: mule

计算Mule流处理的请求

我正在使用Mule ESB 3.4。 我想开发一个自定义Java组件来计算流接收的请求数。 流程将是这样的: http inbound-endpoint -> counter -> vm-outbound-endpoint 首先,包含计数器的实际变量应存储在内存中。 然后它可能会被打印到日志中或插入到数据库中(现在这并不重要)。 我所追求的是一个干净的设计,我可以在以后重新使用它来存储更​​复杂的应用程序全局状态(基于接收消息的数量和内容)并实现更复杂的逻辑。

Spring3dependency injection无法使用mule

我无法在CustomerServiceImpl服务类中的引用变量中注入customerDao对象。 这是我的mule_flow.mflow文件 这是我的Spring-mule.xml文件 classpath:hibernate.cfg.xml org.hibernate.cfg.AnnotationConfiguration org.hibernate.dialect.Oracle10gDialect true org.hibernate.cache.NoCacheProvider auto 这是我的CustomerServiceImpl.java package com.proj.pos.webservice.implementation; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.WebService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import com.proj.pos.dao.interfac.CustomerDao; import com.proj.pos.entity.Customer; import com.proj.pos.webservice.interfac.CustomerService; @WebService(endpointInterface = “com.proj.pos.webservice.interfac.CustomerService”, serviceName = “CustomerService”) public class CustomerServiceImpl implements CustomerService { public CustomerDao getCustomerDao() { return customerDao; } public void setCustomerDao(CustomerDao customerDao) { this.customerDao […]

java类信任所有用于将文件发送到https Web服务

我需要编写自己的类来告诉mule https连接到服务(wsdl)已经过validation。 我已经有mule子项目接近完成但最后一块丢失,在特定url发送文件。 我想要实现的目标: 建立连接并将xml发送到目标URL 读取也在xml中的响应 服务器使用自签名证书的安全性。 到目前为止我所做的是我从该链接获得证书并将其导入.jks。 然后我可能跟随所有“教程”如何使用https连接器连接到mule服务器,但在我的情况下没有任何工作。 我认为最好的事情是,如果有人可以帮助我创建java类来绕过密钥检查并返回true(已validation)。 就像是: URL url = new URL(“https://www.google.com”); HttpsURLConnection conn= (HttpsURLConnection) url.openConnection(); conn.setHostnameVerifier(new HostnameVerifier() { @Override public boolean verify(String arg0, SSLSession arg1) { return true; } }); 我怎么能在mule子那样做? 我希望它会是这样的 。 我正在使用当前的mule版本(3.5.0) 谢谢! 编辑: 我的配置:

测试Mule中的子流程

我已经开始将测试用例写入我的Mule项目了。 我已经为我的Main Flows编写了function测试用例,如下所示。 public void testMainFlow_1() throws Exception{ MuleClient client = muleContext.getClient(); MuleMessage result = client.send(helloServiceAddress, fileAsString(“SamplePayloads/input_Request.xml”), properties); assertNotNull(“Null Result”, result); assertEquals(result.getPayloadAsString(), fileAsString(“SampleResponses/sampleResponse.xml”)); } 但是我如何测试我的子流程。 他们没有任何终点。 那么如何将有效载荷传递给它们并进行测试呢。 以下是我的流量配置。 …. …. …. …. …. …. …. …. …. ….

如何解决消息有效负载的类型为:BufferInputStream Mule中的exception

我已经转换为字节数组但我不断收到此错误: ERROR 2015-02-25 11:12:30,517 [[ESR].HTTP_Request_Listener.worker.01] org.mule.exception.DefaultMessagingExceptionStrategy: ******************************************************************************** Message : Response code 400 mapped as failure. Message payload is of type: BufferInputStream Code : MULE_ERROR–2 ——————————————————————————– Exception stack is: 1. Response code 400 mapped as failure. Message payload is of type: BufferInputStream (org.mule.module.http.internal.request.ResponseValidatorException) org.mule.module.http.internal.request.SuccessStatusCodeValidator:37 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/module/http/internal/request/ResponseValidatorException.html) ——————————————————————————– Root Exception stack trace: org.mule.module.http.internal.request.ResponseValidatorException: Response code 400 mapped as […]

Java的内存SFTP服务器有什么用?

我有一些代码,我需要编写一个测试,连接到供应商的SFTP服务器并将文件放在那里。 现在测试是连接到他们的实际服务器,但我宁愿不这样做。 理想情况下,我想在MockFtpServer中使用假的,内存中的服务器。 我尝试使用那个并且它在那里得到了一部分但是在发出实际命令时死亡,因为它不能识别它们。 有问题的代码是Mule ESB中的流程设置。

NoClassDefFoundError:javax / validation /validation甚至在POM中validation-api 1.1.0.Final

看起来很奇怪……我有exception追踪: org.apache.cxf.interceptor.Fault at org.mule.module.cxf.MuleInvoker.invoke(MuleInvoker.java:117) at org.mule.module.cxf.MuleJAXWSInvoker.invoke(MuleJAXWSInvoker.java:47) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75) at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:123) at org.mule.module.cxf.CxfInboundMessageProcessor.sendToDestination(CxfInboundMessageProcessor.java:295) at org.mule.module.cxf.CxfInboundMessageProcessor.process(CxfInboundMessageProcessor.java:136) at org.mule.module.cxf.config.FlowConfiguringMessageProcessor.process(FlowConfiguringMessageProcessor.java:52) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47) at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:106) at org.mule.processor.AsyncInterceptingMessageProcessor.process(AsyncInterceptingMessageProcessor.java:101) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61) at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47) at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:95) at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:70) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) […]

信任所有证书的Mule HTTPS连接器

我正在为Mule ESB应用程序编写集成测试。 Mule应用程序通过HTTPS连接到第三方API。 当我尝试针对第三方测试API端点运行我的应用程序时,一切正常,我不必将任何客户端特定的SSL配置添加到HTTPS连接器。 我相信这是因为他们的服务器具有CA签名证书,因此他们可以立即受到信任,例如像这样的HTTP连接器 将开箱即用。 在编写集成测试时,我会存根(或者如果您愿意,可以模拟)第三方API。 但是,为了使SSL工作,我必须为嵌入式HTTPS服务器生成密钥库,并通过添加来修改客户端HTTPS连接器 正如互联网上所提到的那样。 我可以在一个单独的XML文件中定义测试HTTPS连接器,并将其加载到FunctionalTestCase.getConfigResources()方法中。 然而,这并不理想:我真正想要的是使HTTPS连接器(客户端)信任所有内容的方法 – 但仅在运行集成测试时 – 即在执行Maven构建时。 这必须以编程方式发生,以便保持Mule应用程序代码不变。 我试图将以下代码添加到@BeforeClass注释方法中 http://www.rgagnon.com/javadetails/java-fix-certificate-problem-in-HTTPS.html 但没有运气。 运行集成测试时,我仍然遇到以下exception Exception stack is: 1. unable to find valid certification path to requested target (sun.security.provider.certpath.SunCertPathBuilderException) sun.security.provider.certpath.SunCertPathBuilder:196 (null) 2. PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target (sun.security.validator.ValidatorException) sun.security.validator.PKIXValidator:385 (null) 3. […]

Mule可以运行JavaEE Web应用程序吗?

我正在尝试将Java servlet转换为Mule Web服务,但我的程序有多个类。 我已经看过很多关于在Java组件中使用POJO和Mule的教程,但从来没有一个带有多个类的程序。 如何才能做到这一点? 编辑:我的servlet当前正在tomcat服务器上运行。 它接收带有搜索详细信息的xml文档,搜索数据库,然后输出带有搜索结果的xml文档。 xml解析和生成,以及数据库连接和查询都由servlet当前处理。 我只是希望能够使用Mule运行它,而不是在tomcat服务器上运行它。

如何使用MUnit在Mule Flow中模拟Java组件

我正在尝试使用MUnit对我的一个子流进行unit testing,我需要模拟一个自定义Java组件,但我无法这样做。 我的子流程如下所示 <!– –> 这是我失败的unit testing @Test public void givenAValidPayload_whenFlowIsInvoked_itShouldSendPayloadToDestinationSFTPOnlyOnce() throws Exception { destinationSFTP.thenReturnSameEvent(); sourceArchiveSFTP.thenReturnSameEvent(); deleteProcessedFileComponent.thenReturnSameEvent(); successEmail.thenReturnSameEvent(); MuleEvent testEvent = PropertyEnricher.enrich(testEvent(IOUtils.toInputStream(“hello,dummy,payload”))).get(); runFlow(PROCESS_CSV_FLOW, testEvent); verifyCallOfMessageProcessor(“outbound-endpoint”) .ofNamespace(“sftp”) .withAttributes(attribute(“name”).ofNamespace(“doc”).withValue(“DestinationSFTP”)) .times(1); } 我试图嘲笑组件 deleteProcessedFileComponent = whenMessageProcessor(“component”) .withAttributes(attribute(“name”).ofNamespace(“doc”).withValue(“Delete Read File”)); 我尝试了一些变化,没有一个工作,我猜一个组件不是MessageProcessor 我得到的例外情况如下 org.mule.api.lifecycle.InitialisationException: Component has not been initialized properly, no flow constuct. at org.mule.component.AbstractComponent.initialise(AbstractComponent.java:218) at org.mule.processor.chain.AbstractMessageProcessorChain.initialise(AbstractMessageProcessorChain.java:80) at org.mule.processor.chain.AbstractMessageProcessorChain$$FastClassByCGLIB$$38c17d88.invoke() at […]