MuleRequester deleting file after reading - mule

Following is my mule configuration.
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:quartz="http://www.mulesoft.org/schema/mule/quartz" xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns:test="http://www.mulesoft.org/schema/mule/test"
xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns:mulerequester="http://www.mulesoft.org/schema/mule/mulerequester"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/quartz http://www.mulesoft.org/schema/mule/quartz/current/mule-quartz.xsd
http://www.mulesoft.org/schema/mule/test http://www.mulesoft.org/schema/mule/test/3.6/mule-test.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.6/mule.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.6/mule-vm.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.6/mule-http.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/mulerequester http://www.mulesoft.org/schema/mule/mulerequester/1.0-SNAPSHOT/mule-mulerequester.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/3.6/mule-file.xsd">
<vm:outbound-endpoint exchange-pattern="one-way"
path="oozieQueue" doc:name="Trigger workflow" />
</flow>
<flow name="oozie-workflow-manager" doc:name="oozie-workflow-manager">
<vm:inbound-endpoint exchange-pattern="one-way"
path="oozieQueue" doc:name="VM" />
<foreach collection="#[payload.items()]" counterVariableName="counter">
<choice doc:name="Choice">
<when expression="#[payload.status == CampaignStatus.NOT_STARTED]">
<mulerequester:request config-ref="Mule_Requester"
resource="file://#[payload.fileName]" returnClass="java.lang.String" doc:name="Request a message from a queue" />
<logger level="ERROR" message="Payload is : #[message.payload]" />
<enricher target="#[variable:jsonResponse]">
<http:outbound-endpoint exchange-pattern="request-response"
address="http://abc.xyz.com:11000/oozie/v2/jobs?action=start"
method="POST" doc:name="HTTP"
contentType="application/xml;charset=UTF-8" />
</enricher>
<choice doc:name="Choice">
<when expression="#[message.inboundProperties['http.status'] == 201]">
<component doc:name="Java">
<singleton-object
class="com.xyz.alertcampaign.appworkflow.JobUpdater" />
</component>
</when>
<otherwise>
<logger level="ERROR" message="Error occurred on creating Job in OOzie " />
</otherwise>
</choice>
</when>
<when
expression="#[payload.status == CampaignStatus.UPDATED || payload.status == CampaignStatus.EXPIRED]">
<logger level="ERROR" message="#[payload.status]" />
<http:outbound-endpoint exchange-pattern="request-response"
method="PUT"
address="http://localhost:8080/oozie/v1/job/#[payload.jobId]?action=kill"
responseTransformer-refs="httptoobj" doc:name="HTTP" />
<choice doc:name="Choice">
<when expression="#[message.inboundProperties['http.status'] == 200]">
<component doc:name="Java">
<singleton-object
class="com.xyx.alertcampaign.appworkflow.JobUpdater" />
</component>
</when>
<otherwise>
<logger level="ERROR" message="Error occurred on killing Job in OOzie " />
</otherwise>
</choice>
</when>
</choice>
</foreach>
</flow>
I have a symbolic link for the file path . But both the symbolic link and the file is getting deleted after MuleRequester is done.

Try setting the resource url to file://#[payload.fileName]?autoDelete=false

Related

Mocking SubFlow in Mule

I am trying to create MUnit for the below flow.
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<db:oracle-config name="Oracle_Configuration" host="127.0.0.1" port="1521" instance="xe" user="system" password="madhu" doc:name="Oracle Configuration"/>
<flow name="munitFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/munit" doc:name="HTTP"/>
<object-to-string-transformer doc:name="Object to String"/>
<set-payload value="#[payload]" doc:name="Set Payload"/>
<flow-ref name="SubFlow1" doc:name="SubFlow1"/>
<choice doc:name="Choice">
<when expression="#[flowVars.temp == '1']">
<set-payload value="Hello from madhu" doc:name="Set Payload"/>
</when>
<otherwise>
<set-payload value="Hello from mitha" doc:name="Set Payload"/>
</otherwise>
</choice>
</flow>
<sub-flow name="SubFlow1">
<choice doc:name="Choice">
<when expression="#[payload=='1']">
<set-variable variableName="temp" value="1" doc:name="set temp to 1"/>
</when>
<otherwise>
<set-variable variableName="temp" value="2" doc:name="set temp to 2"/>
</otherwise>
</choice>
</sub-flow>
</mule>
I have create two test flows for subflow, which is working fine.
Eventhough I mocked subflow to test the main flow, the flow is executing the sub flow. Any ideas if I am missing something while mocking the sub flow. Any help will be highly appreciated.
This is my testsuite
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:munit="http://www.mulesoft.org/schema/mule/munit" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" xmlns:mock="http://www.mulesoft.org/schema/mule/mock" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/munit http://www.mulesoft.org/schema/mule/munit/current/mule-munit.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/mock http://www.mulesoft.org/schema/mule/mock/current/mule-mock.xsd">
<munit:config name="munit" doc:name="MUnit configuration"/>
<spring:beans>
<spring:import resource="classpath:munit.xml"/>
</spring:beans>
<munit:test name="munit-test-suite-munitSub_FlowTest" description="Test">
<munit:set payload="1" doc:name="Set Message"/>
<flow-ref name="SubFlow1" doc:name="SubFlow1"/>
<mock:verify-call messageProcessor="mule:set-variable" doc:name="Verify Call">
<mock:with-attributes>
<mock:with-attribute name="doc:name" whereValue="#['set temp to 1']"/>
</mock:with-attributes>
</mock:verify-call>
</munit:test>
<munit:test name="munit-test-suite-munitSub_FlowTest1" description="Test">
<munit:set payload="2" doc:name="Set Message"/>
<flow-ref name="SubFlow1" doc:name="SubFlow1"/>
<mock:verify-call messageProcessor="mule:set-variable" doc:name="Verify Call">
<mock:with-attributes>
<mock:with-attribute name="doc:name" whereValue="#['set temp to 2']"/>
</mock:with-attributes>
</mock:verify-call>
</munit:test>
<munit:test name="munit-test-suite-munitFlowTest" description="Test">
<mock:when messageProcessor=".*:.*" doc:name="Mock">
<mock:with-attributes>
<mock:with-attribute name="doc:name" whereValue="#['Set Payload']"/>
</mock:with-attributes>
<mock:then-return payload="#[samePayload()]"/>
</mock:when>
<mock:when messageProcessor="mule:sub-flow" doc:name="Mock">
<mock:with-attributes>
<mock:with-attribute name="doc:name" whereValue="#[matchContains('SubFlow1')]"/>
</mock:with-attributes>
<mock:then-return payload="#[samePayload()]">
<mock:invocation-properties>
<mock:invocation-property key="temp" value="1"/>
</mock:invocation-properties>
</mock:then-return>
</mock:when>
<flow-ref name="munitFlow" doc:name="munitFlow"/>
<munit:assert-payload-equals message="Wrong payload" expectedValue="Hello from madhu" doc:name="Assert Payload"/>
</munit:test>
</mule>
The culprit is this
<mock:with-attribute name="doc:name" whereValue="#[matchContains('SubFlow1')]"/>
The name should be name not doc:name

Scatter Gather Mule Exception : getPayloadAsString(), use getPayloadAsString(DataType.STRING_DATA_TYPE)

I am using a Scatter Gather (component mule esb) witch contains many Saleforce Calls , after the Scatter Gather procces i got the following excpetion :
java.lang.UnsupportedOperationException : getPayloadAsString(), use getPayloadAsString(DataType.STRING_DATA_TYPE)
The config of the Scatter Gather component is by default
There is my xml config
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw"
xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking"
xmlns:sfdc="http://www.mulesoft.org/schema/mule/sfdc"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http
http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/sfdc
http://www.mulesoft.org/schema/mule/sfdc/current/mule-sfdc.xsd
http://www.mulesoft.org/schema/mule/ee/tracking
http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/ee/dw
http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd">
<flow name="Test1">
<http:listener config-ref="httpListenerConfig" path="/test1" doc:name="HTTP"
allowedMethods="POST"/>
<dw:transform-message doc:name="Transform Message">
<dw:set-payload><![CDATA[%dw 1.0
%output application/java
—
payload]]></dw:set-payload>
</dw:transform-message>
<logger level="INFO" doc:name="Logger" message="Before Scatter Gather"/>
<scatter-gather doc:name="Scatter-Gather">
<processor-chain>
<sfdc:query config-ref="Salesforce__Basic_Authentication" query="Query
code....."/>
<logger level="INFO" doc:name="Logger" message="Call Saleforce Number 1"/>
</processor-chain>
<processor-chain>
<sfdc:query config-ref="Salesforce__Basic_Authentication" query="Query
code....."/>
<logger level="INFO" doc:name="Logger" message="Call Saleforce Number 2"/>
</processor-chain>
...
...
</scatter-gather>
<logger level="INFO" doc:name="Logger" message="After Scatter Gather"/>
<foreach doc:name="For Each">
<logger level="INFO" doc:name="Logger" message="First ForEach"/>
<foreach doc:name="For Each">
<logger level="INFO" doc:name="Logger" message="Second ForEach"/>
<flow-ref name="flowRefTest1" doc:name="flowRefTest1"/>
</foreach>
</foreach>
</flow>
</mule>
Any ideas how to resolve this problem guys ?
the reason for that sort of output is because the http endpoint in the beginning is not getting proper response to display so try setting payload in a proper format stating the completion after all the calls to Salesforce are done.
Hope this helps

Unable to post a file to http endpoint inside a choice in mule

Here's the my mule app xml config
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:quartz="http://www.mulesoft.org/schema/mule/quartz"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:test="http://www.mulesoft.org/schema/mule/test"
xmlns:file="http://www.mulesoft.org/schema/mule/file"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/quartz http://www.mulesoft.org/schema/mule/quartz/current/mule-quartz.xsd
http://www.mulesoft.org/schema/mule/test http://www.mulesoft.org/schema/mule/test/3.6/mule-test.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.6/mule.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.6/mule-vm.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.6/mule-http.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/3.6/mule-file.xsd">
<object-to-string-transformer name="httptoobj" />
<file:connector name="input"/>
<http:http-response-to-object-transformer
name="httptostring" />
<configuration>
<expression-language autoResolveVariables="false">
<import class="com.xyz.alertcampaign.appworkflow.CampaignStatus" />
</expression-language>
</configuration>
<flow name="polling" doc:name="polling" processingStrategy="synchronous">
<quartz:inbound-endpoint repeatInterval="3000"
startDelay="3000" jobName="couchbasePoller" doc:name="Quartz">
<quartz:event-generator-job stateful="true" />
</quartz:inbound-endpoint>
<component doc:name="Java">
<singleton-object
class="com.xyz.alertcampaign.appworkflow.CouchbasePoller" />
</component>
<vm:outbound-endpoint exchange-pattern="one-way"
path="oozieQueue" doc:name="Trigger workflow" />
</flow>
<flow name="oozie-workflow-manager" doc:name="oozie-workflow-manager">
<vm:inbound-endpoint exchange-pattern="one-way"
path="oozieQueue" doc:name="VM" />
<foreach collection="#[payload.items()]" counterVariableName="counter">
<choice doc:name="Choice">
<when expression="#[payload.status == CampaignStatus.NOT_STARTED]">
<file:inbound-endpoint address="file://#[payload.fileName]" connector-ref="input"/>
<http:outbound-endpoint exchange-pattern="request-response"
address="http://localhost:8080/oozie/v1/jobs"
responseTransformer-refs="httptoobj" method="POST" doc:name="HTTP"
contentType="application/xml;charset=UTF-8" />
<choice doc:name="Choice">
<when expression="#[message.inboundProperties['http.status'] == 201]">
<component doc:name="Java">
<singleton-object
class="com.xyz.alertcampaign.appworkflow.JobUpdater" />
</component>
</when>
<otherwise>
<logger level="ERROR" message="Error occurred on creating Job in OOzie " />
</otherwise>
</choice>
</when>
<when
expression="#[payload.status == CampaignStatus.UPDATED || payload.status == CampaignStatus.EXPIRED]">
<logger level="ERROR" message="#[payload.status]" />
<http:outbound-endpoint exchange-pattern="request-response"
method="PUT"
address="http://localhost:8080/oozie/v1/job/#[payload.jobId]?action=kill"
responseTransformer-refs="httptoobj" doc:name="HTTP" />
<choice doc:name="Choice">
<when expression="#[message.inboundProperties['http.status'] == 200]">
<component doc:name="Java">
<singleton-object
class="com.xyz.alertcampaign.appworkflow.JobUpdater" />
</component>
</when>
<otherwise>
<logger level="ERROR" message="Error occurred on killing Job in OOzie " />
</otherwise>
</choice>
</when>
</choice>
</foreach>
</flow>
</mule>
Getting following exception (stack):
Exception when loading mule' xml:
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'file:inbound-endpoint'. One of '{"http://www.mulesoft.org/schema/mule/core":abstract-message-processor, "http://www.mulesoft.org/schema/mule/core":abstract-outbound-endpoint, "http://www.mulesoft.org/schema/mule/core":abstract-mixed-content-message-processor}' is expected.
Why am I not allowed to post a file to http inside choice router?
You can only use a file:inbound-endpoint at the beginning of a flow. If you're trying to retrieve a file mid-flow, then consider using the Mule Requestor module. This allows you to request a resource (i.e. a file) at any point in a flow.
The problem is that it's an inbound endpoint so you are adding a message source in the middle of a flow. What you should do is define another flow that starts with that file inbound endpoint (with all that logic) and use a flow reference element in the choice to it.
For more details check out the doc.
Additionaly I think there is another problem where the inbound endpoint does not allow dynamic inputs. I solved it via MuleRequester

Making call to Rest services in mule ESB

I have made a web app which call mule server which is listening to http inbound point at 8081 for accessing the database.I am accessing the database successfully and getting a message. But I want to access the other rest services after I get the object from the database and run some operations.
I don't know how to achieve this.
Please give me example. I am posting my flow.
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:jersey="http://www.mulesoft.org/schema/mule/jersey" xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.5.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
http://www.mulesoft.org/schema/mule/jersey http://www.mulesoft.org/schema/mule/jersey/current/mule-jersey.xsd
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">
<http:endpoint exchange-pattern="request-response" host="localhost" port="8081" method="POST" name="HTTP" doc:name="HTTP"/>
<db:mysql-config name="MySQL_Configuration" host="localhost" port="3306" user="root" password="123456" database="Customer" doc:name="MySQL Configuration"/>
<flow name="muleesbintegrationFlow1" doc:name="muleesbintegrationFlow1">
<http:inbound-endpoint exchange-pattern="request-response" path="crud" doc:name="HTTP" ref="HTTP"/>
<set-session-variable variableName="input" value="#[message.inboundProperties.'http.query.params'.input]" doc:name="input"/>
<set-session-variable variableName="cid" value="#[message.inboundProperties.'http.query.params'.cid]" doc:name="cid"/>
<set-session-variable variableName="fname" value="#[message.inboundProperties.'http.query.params'.fname]" doc:name="fname"/>
<set-session-variable variableName="lname" value="#[message.inboundProperties.'http.query.params'.fname]" doc:name="lname"/>
<choice doc:name="ChoicerOfCrud">
<when expression="#[sessionVars['input']== "insert"]">
<db:insert config-ref="MySQL_Configuration" doc:name="insert">
<db:parameterized-query><![CDATA[INSERT INTO `Customer`.`customer` (`customer_id`, `fname`, `lname`) VALUES (#[sessionVars['cid']], #[sessionVars['fname']], #[sessionVars['lname']]);]]></db:parameterized-query>
</db:insert>
</when>
<when expression="#[sessionVars['input']]=="update"]">
<db:update config-ref="MySQL_Configuration" doc:name="update">
<db:parameterized-query><![CDATA[UPDATE `Customer`.`customer` set
fname = #[sessionVars['fname']],
lname= #[sessionVars['lname']]
where customer_id = #[sessionVars['cid']];]]></db:parameterized-query>
</db:update>
</when>
<when expression="#[sessionVars['input']=="select"]">
<db:select config-ref="MySQL_Configuration" doc:name="selected">
<db:parameterized-query><![CDATA[SELECT * FROM Customer.customer where customer_id =#[sessionVars['cid']];]]></db:parameterized-query>
</db:select>
</when>
<otherwise>
<db:delete config-ref="MySQL_Configuration" doc:name="delete">
<db:dynamic-query><![CDATA[DELETE FROM `Customer`.`customer` WHERE `customer_id`=#[sessionVars['cid']];]]></db:dynamic-query>
</db:delete>
</otherwise>
</choice>
</flow>
</mule>
I recommend to use http:outbound-endpoint to consume a REST service (GET,POST, PUT or DELETE). In this example you can see a flow to invoke a services GET:
<flow name="invoke-ws" doc:name="invoke-ws">
<vm:inbound-endpoint exchange-pattern="request-response" path="vm-ws" doc:name="VM"/>
<logger message="payload is: #[payload]" level="INFO" doc:name="Logger"/>
<http:outbound-endpoint exchange-pattern="request-response" method="GET" address="http://ip:port/service/#[payload]" doc:name="HTTP">
<set-property propertyName="Accept" value="application/json"/>
</http:outbound-endpoint>
<byte-array-to-string-transformer doc:name="Byte Array to String"/>
<logger message="payload is: #[payload]" level="INFO" doc:name="Logger"/>
</flow>
If the service is SOAP over HTTP, I recommend using http://www.mulesoft.org/documentation/display/current/Web+Service+Consumer

How to use choice in Mule and to get value of variable "MULE_JDBC_UDATE_COUNT" back to client

I'm trying to get my choice branch in Mule to branch on number of parameters in http.query.params is that possible?
How do I return the value of the MULE_JDBC_UDATE_COUNT variable to the client?
My config.xml
<spring:beans>
<spring:bean id="InformixDatasource" name="InformixDatasource" class="org.enhydra.jdbc.standard.StandardDataSource">
<spring:property name="password" value="xxxxx"></spring:property>
<spring:property name="driverName" value="com.informix.jdbc.IfxDriver"></spring:property>
<spring:property name="user" value="informix"></spring:property>
<spring:property name="url" value="jdbc:informix-sqli://browning.frett.ehf:1527/dev:informixserver=ol_brown"></spring:property>
</spring:bean>
</spring:beans>
<jdbc-ee:connector name="InformixConnector" dataSource-ref="InformixDatasource" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database"></jdbc-ee:connector>
<flow name="postdrefing_fetch_dataFlow1" doc:name="postdrefing_fetch_dataFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="0.0.0.0" port="8084" doc:name="HTTP" path="postdreifing"></http:inbound-endpoint>
<logger message="before db Choice #[message.payload]" level="INFO" doc:name="Logger"></logger>
<choice doc:name="Choice">
<when expression="message.inboundProperties['dreifing'] != null and message.inboundProperties['dags'] != null or message.inboundProperties['dags'] != null">
<logger message="delete #[message.inboundProperties['http.query.params']]" level="INFO" doc:name="Logger"></logger>
<jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryKey="deleteById" queryTimeout="-1" connector-ref="InformixConnector" doc:name="Delete from nafnadreifing by id">
<jdbc-ee:query key="deleteById" value="DELETE FROM fdr_nafnadreifing WHERE dreifing = #[message.inboundProperties['dreifing']] and dags = TO_DATE(#[message.inboundProperties['dags']],'%d%m%Y')"></jdbc-ee:query>
</jdbc-ee:outbound-endpoint>
<logger message="Deleted #[flowVars['MULE_JDBC_UDATE_COUNT']] rows" level="INFO" doc:name="Logger"></logger>
<set-payload value="Deleted #[flowVars['MULE_JDBC_UDATE_COUNT']] rows" doc:name="Set Payload"/>
</when>
<otherwise>
<logger message="default" level="INFO" doc:name="Logger"></logger>
<jdbc-ee:outbound-endpoint exchange-pattern="request-response" queryKey="selectStatement" queryTimeout="-1" connector-ref="InformixConnector" doc:name="Select all from ibudaskra">
<jdbc-ee:query key="selectStatement" value="SELECT skyring,gata,gata_thgf,husnumer,auka,pnr,hverfi,ibudafjoldi,fjolpostur,athugasemdir,breytt,bannmerki,uppfaert,sortnr,pakki,active,tegund,ibud FROM fdr_ibudaskra"></jdbc-ee:query>
</jdbc-ee:outbound-endpoint>
<json:object-to-json-transformer doc:name="Object to JSON"></json:object-to-json-transformer>
</otherwise>
</choice>
</flow>
Yes, this is possible, with something like #[message.inboundProperties['http.query.params']['myQueryParamName']]. Be sure to use #[ ] around your expression and also use '&&' and '||' for boolean operations.
<when expression="#[message.inboundProperties['dreifing'] != null && message.inboundProperties['dags'] != null || message.inboundProperties['dags'] != null]">
It also seems you're missing parenthesis around the part of this expression.
Use set-payload:
<set-payload value="#[flowVars['MULE_JDBC_UDPATE_COUNT']]" />