mule

How to add a global exception handler/logger once in Mule

霸气de小男生 提交于 2020-01-14 12:37:13
问题 We want to add a few lines of XML config to mule with an exception handler that logs to SLF4J instead of where they log right now (stdout). How do we add this? We do NOT want to have to add this handler to every single flow (50+ flows, plus as people add flows, they may forget to add our exception handler). 回答1: This is an example of "how to share a common exception handler across flows" (in this case a catch-exception-strategy): <catch-exception-strategy name="myGlobalCatchStrategy"> <set

Ignore and log CSV row in DataWeave if condition is met

感情迁移 提交于 2020-01-14 02:56:09
问题 In DataWeave, is it possible to ignore a particular row in a CSV file if a condition is met. I'm transforming a file where some rows need to be ignored because a column has a value indicating a particular row shouldn't be mapped to the output. What I want to do in this scenario is skip that row, log (if possible) and then move on to mapping the next row. I've looked through the docs and the closest I've found to an answer is wrapping the mapping in a when otherwise clause. I can't find

How to implement Mule HTTP GET Method redirect?

谁说我不能喝 提交于 2020-01-13 07:21:18
问题 I'm trying to redirect HTTP GET requests to a seperate web server. I could not find any example code. I configured mule.xml as below. I think there must be a better way than this. Any ideas? thanks. <flow name="sampleInsert" doc:name="sampleInsert"> <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" responseTimeout="1" doc:name="HTTP" path="indb/sampleInsert" > </http:inbound-endpoint> <logger level="INFO" doc:name="Logger" message="In Time #[server

Mule ESB:Context Property Placeholder

孤街醉人 提交于 2020-01-12 14:05:00
问题 I have a question regarding Mule's context property placeholder, I have two files set up like this: <context:property-placeholder location="classpath:mule-app-1.properties, file:///etc/mule/conf/mule-app-2.properties" /> Firstly is this a valid configuration, secondly which file will take precedence over the other? app1 or app2 file? -S 回答1: Each will be loaded in turn, overwriting duplicate properties from the first one. So in your case, properties defined in mule-app-2.properties will take

Mule ESB:Context Property Placeholder

二次信任 提交于 2020-01-12 14:02:32
问题 I have a question regarding Mule's context property placeholder, I have two files set up like this: <context:property-placeholder location="classpath:mule-app-1.properties, file:///etc/mule/conf/mule-app-2.properties" /> Firstly is this a valid configuration, secondly which file will take precedence over the other? app1 or app2 file? -S 回答1: Each will be loaded in turn, overwriting duplicate properties from the first one. So in your case, properties defined in mule-app-2.properties will take

Sending formatted mails with Mule

本秂侑毒 提交于 2020-01-11 06:47:09
问题 I'm sending emails using Mule. I need to add format to the text I send. The content of the mail is the payload which has a String in it that I form in a Java method and send to the flow with an Expression transformer. I need to add format to that String: bold, underline, colour.... How can I do it? This is an extract of my flow: <expression-transformer expression="#[com.generateText4Email(payload)]" doc:name="mailText"/> <smtp:outbound-endpoint host="${smtp.host}" responseTimeout="10000" doc

mule expression transformer exception

爷,独闯天下 提交于 2020-01-07 08:31:09
问题 I have a payload like {"jcr:createdBy":"admin","jcr:content":{"sling:resourceType":"contentpage","addressdetails":{"state":"vic"}}} I want to change the value of state. I have tried the below, <expression-transformer expression="#[message.payload.jcr:content.addressdetails.state = 'NSW';message.payload]" doc:name="Expression" /> but this throws an exception, invalid expression. I believe its because of : in jcr:createdBy. How should I handle this? 回答1: Try <json:json-to-object-transformer

Dataweave empty array input add default key:value

旧城冷巷雨未停 提交于 2020-01-07 02:55:11
问题 is there a way to map a http response which is in json array to another json map also considering default values i.e when it is empty map a default key pair? input { "key1": [] "key2":[x,y] } req output {"table":[{ "a-key1": "deafault-value", "a-key2": "x", "b-key2": "y" }] } 回答1: You can use default keyword only in case of null but for blank and empty array you can use something like %dw 1.0 %output application/json %function getDefault(inputdata, defaultvalue) inputdata when inputdata !=

Mule - Delete files with Files Connector

假如想象 提交于 2020-01-07 01:49:29
问题 This is my main mule flow : HTTP > Payload > File (Create) > Property (File Name) JMS And that JMS calls to other flow that starts with JMS JMS > JSON TO XML > File (Delete by file name) Firstly, I create a file with the JSON message. And finally, when JSON message is transformed to XML , I try to delete the file by name calling a property that tell me the name. But the files doesn't delete. Its output this action by log: Writing file to: C:\errors\91fa03a0-dd33-11e5-a0d9-408d5c4c1bf3.dat How

Getting “muleContext cannot be resolved” error in mule Junit test code

谁说胖子不能爱 提交于 2020-01-06 19:29:31
问题 I am getting error "Unresolved compilation problem: muleContext cannot be resolved" at the line "MuleClient client = muleContext.getClient();" in JUnit test code in Mule. As per my understanding this code is correct. Since i am new to JUnit, i am not getting why this error is coming. Can anyone help me to getout from this problem please. For your information below are the flow and Junit test code. Junit Test: import java.io.IOException; import org.mule.api.client.MuleClient; import org.junit