Receving error Message : "org.mule.runtime.api.exception.MuleRuntimeException - Could not read from file store, while reading payload as Xml.
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:amqp="http://www.mulesoft.org/schema/mule/amqp"
xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/amqp http://www.mulesoft.org/schema/mule/amqp/current/mule-amqp.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<amqp:config name="AMQP_Config" doc:name="AMQP Config" doc:id="e0e4ca51-72e7-4d3b-bf01-705aacee16f0" >
<amqp:connection host="orangutan.rmq.cloudamqp.com" port="5672" virtualHost="xxxx" username="xxxx" password="xxxx" />
</amqp:config>
<flow name="artvanFlow" doc:id="59d15f19-3a12-491a-90a0-b2c980dbb05a" >
<amqp:listener doc:name="Listener" doc:id="ea9cb6d6-ccad-4a7f-8925-5879b561910e" config-ref="AMQP_Config" queueName="PIMQueue" outputMimeType="application/xml"/>
<ee:transform doc:name="Transform Message" doc:id="cddf8b22-91af-46b4-a8d6-c4237de75307" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
{
INVMSTP: {
IMDEL: payload.Root.STG_SKU.Activity_Code default ""
}
}]]></ee:set-payload>
</ee:message>
</ee:transform>
<logger level="INFO" doc:name="Logger" doc:id="a3411653-aff7-4363-8d24-6c10334d816f" message="#[payload]"/>
</flow>
</mule>
Apple to resolve the issue. There is no issue with the mule code. Input XML has
<?xml version="1.0" **encoding="WINDOWS-1251"** standalone="yes"?>
if I change to
<?xml version="1.0" **encoding="utf-8"** standalone="yes"?>
Things are fine.
Related
Looking to implement in following into Mulesoft HTTP request
curl "https://somedomain.com/1/1/1/search"
-X POST
-H "Authorization: Bearer token"
<?xml version="1.0" encoding="UTF-8"?>
<mule 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:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="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">
<flow name="MyRequestFlow" doc:id="04948f48-2508-4f1c-83fe-ea899886a61c" >
<http:request method="POST" doc:name="Request" doc:id="bd921beb-2142-4c24-be1d-c174e994c982" url="https://somedomain.com/1/1/1/search">
<http:headers ><![CDATA[#[output application/java
---
{
"Authorization" : "Bearer token"
}]]]></http:headers>
</http:request>
</flow>
</mule>
Im am trying to get the xml tag to be a part of the file name but im not getting any value. Am I doing something wrong? Im getting an error or a null value when I change the transformer
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:email="http://www.mulesoft.org/schema/mule/email" xmlns:pop3="http://www.mulesoft.org/schema/mule/pop3" 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/pop3 http://www.mulesoft.org/schema/mule/pop3/current/mule-pop3.xsd
http://www.mulesoft.org/schema/mule/email http://www.mulesoft.org/schema/mule/email/current/mule-email.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd">
<flow name="email_notificationFlow">
<file:inbound-endpoint path="C:\Users\pd00h\Desktop\Knauf\testxML" responseTimeout="10000" doc:name="File"/>
<file:file-to-byte-array-transformer doc:name="File to Byte Array"/>
<set-variable variableName="order" value="#[xpath3('//ns0:Payload/WhsDockets/WhsDocket/Reference')]" doc:name="Variable"/>
<logger message="#[flowVars.order]" level="INFO" doc:name="Logger"/>
<file:outbound-endpoint path="C:\Users\pd00h\Desktop\Knauf" outputPattern="Knauf-#[message.id].xml" responseTimeout="10000" doc:name="File"/>
</flow>
</mule>
Sample Input File
<?xml version="1.0" encoding="utf-8"?><XmlInterchange xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="1" xmlns="http://www.edi.com.au/EnterpriseService/">
<InterchangeInfo>
<Date>2016-02-19T09:31:34.969+09:00</Date>
<XmlType>LightWeight</XmlType>
<Source>
<EnterpriseCode>AWH</EnterpriseCode>
<CompanyCode>ADL</CompanyCode>
<OriginServer>ADL</OriginServer>
</Source>
<Target />
<EDIOrganisation EDICode="AWHLOG_AU" OwnerCode="AWHLOG_AU">
<OrganisationDetails>
<Name>AWH LOGISTICS</Name>
<Location Country="Australia" City="Adelaide">AUADL</Location>
<Addresses>
<Address AddressType="MAIN">
<AddressLine1>Gillman Wool Complex</AddressLine1>
<AddressLine2>GRAND TRUNKWAY,</AddressLine2>
<AddressCode>Gillman Wool Complex</AddressCode>
<CityOrSuburb>GILLMAN</CityOrSuburb>
<StateOrProvince>SA</StateOrProvince>
<PostCode>5013</PostCode>
<TelephoneNumbers>
<TelephoneNumber NumberType="Business">+618 8240 8400</TelephoneNumber>
<TelephoneNumber NumberType="Fax">+618 8240 0080</TelephoneNumber>
</TelephoneNumbers>
<Email>containers#awh.com.au</Email>
<Language>ENG</Language>
<Location>AUADL</Location>
<Sequence>1</Sequence>
<AddressCapabilities>
<AddressCapability AddressType="MAIN" />
<AddressCapability IsMainAddress="true" AddressType="OFC" />
<AddressCapability IsMainAddress="true" AddressType="PAD" />
</AddressCapabilities>
</Address>
</Addresses>
</OrganisationDetails>
</EDIOrganisation>
</InterchangeInfo>
<Payload>
<WhsDockets>
<WhsDocket>
<Identifier>
<Client EDICode="KNAINSBNE" OwnerCode="KNAINSBNE">
<OrganisationDetails>
<Name>Knauf Insulation Pty Ltd</Name>
<Location Country="Australia" City="Brisbane">AUBNE</Location>
<Addresses>
<Address AddressType="MAIN">
<AddressLine1>2/44 BorthwickAve</AddressLine1>
<AddressCode>2/44 BorthwickAve</AddressCode>
<CityOrSuburb>MURARRIE</CityOrSuburb>
<StateOrProvince>QLD</StateOrProvince>
<PostCode>4172</PostCode>
<TelephoneNumbers>
<TelephoneNumber NumberType="Business">+61 (7) 3393-7300</TelephoneNumber>
<TelephoneNumber NumberType="Mobile">+61 (438) 488-000</TelephoneNumber>
<TelephoneNumber NumberType="Fax">+61 (7) 3343-1898</TelephoneNumber>
</TelephoneNumbers>
<Email>orders.au#knaufinsulation.com</Email>
<Language>ENG</Language>
<Location>AUBNE</Location>
<Sequence>1</Sequence>
<AddressCapabilities>
<AddressCapability AddressType="MAIN" />
<AddressCapability IsMainAddress="true" AddressType="OFC" />
</AddressCapabilities>
</Address>
</Addresses>
</OrganisationDetails>
</Client>
<Reference>2363867</Reference>
<DocketType>WOH</DocketType>
<ActionType>CON</ActionType>
</Identifier>
<DocketDetail>
<WarehouseCode>ROC</WarehouseCode>
<CustomerReference>3330826</CustomerReference>
<Units>80</Units>
<Packages>0</Packages>
<Pallets>0</Pallets>
<Weight DimensionType="KG">673</Weight>
<Cubic DimensionType="M3">7.624</Cubic>
<TransportInsurance>0.0000</TransportInsurance>
<ShipperCODAmount>0.0000</ShipperCODAmount>
<CustomerOrderDetail>
<OrderType>ORD</OrderType>
<DateRequired>2015-08-25T00:00:00</DateRequired>
<Consignee AddressType="CEA">
<AddressLine1>71-83 Kenny Street</AddressLine1>
<CityOrSuburb>PORTSMITH</CityOrSuburb>
<StateOrProvince>QLD</StateOrProvince>
<PostCode>4870</PostCode>
<CompanyName>Bunnings Cairns Central Warehouse</CompanyName>
<CountryCode>AU</CountryCode>
<ContactName>The Import Manager</ContactName>
</Consignee>
</CustomerOrderDetail>
<CustomAttributes />
</DocketDetail>
<DocketLines>
<DocketLine>
<Product>E2271</Product>
<Description>R 3 0 145mm x 580mm x 1160mm</Description>
<QuantityFromClientOrder>4</QuantityFromClientOrder>
<QuantityActuallyOrdered>4</QuantityActuallyOrdered>
<ProductUQ>MST</ProductUQ>
<LineAttributes />
<LineNumber>1</LineNumber>
<Confirmation>
<Lines>
<Line>
<Quantity>16</Quantity>
<QuantityUQ>PAC</QuantityUQ>
</Line>
</Lines>
<Quantity>16</Quantity>
</Confirmation>
</DocketLine>
<DocketLine>
<Product>E4386</Product>
<Description>R 2 0 90mm x 580mm x 19000mm</Description>
<QuantityFromClientOrder>4</QuantityFromClientOrder>
<QuantityActuallyOrdered>4</QuantityActuallyOrdered>
<ProductUQ>MST</ProductUQ>
<LineAttributes />
<LineNumber>2</LineNumber>
<Confirmation>
<Lines>
<Line>
<Quantity>32</Quantity>
<QuantityUQ>PAC</QuantityUQ>
</Line>
</Lines>
<Quantity>32</Quantity>
</Confirmation>
</DocketLine>
<DocketLine>
<Product>450521</Product>
<Description>XPS300 30 x 600 x 1200 B1 / On / SE</Description>
<QuantityFromClientOrder>20</QuantityFromClientOrder>
<QuantityActuallyOrdered>20</QuantityActuallyOrdered>
<ProductUQ>PC</ProductUQ>
<LineAttributes />
<LineNumber>3</LineNumber>
<Confirmation>
<Lines>
<Line>
<Quantity>20</Quantity>
<QuantityUQ>PC</QuantityUQ>
</Line>
</Lines>
<Quantity>20</Quantity>
</Confirmation>
</DocketLine>
<DocketLine>
<Product>450523</Product>
<Description>XPS300 50 x 600 x 1200 B1 / On / SE</Description>
<QuantityFromClientOrder>12</QuantityFromClientOrder>
<QuantityActuallyOrdered>12</QuantityActuallyOrdered>
<ProductUQ>PC</ProductUQ>
<LineAttributes />
<LineNumber>4</LineNumber>
<Confirmation>
<Lines>
<Line>
<Quantity>12</Quantity>
<QuantityUQ>PC</QuantityUQ>
</Line>
</Lines>
<Quantity>12</Quantity>
</Confirmation>
</DocketLine>
</DocketLines>
</WhsDocket>
</WhsDockets>
</Payload>
Can you use this to complex XML structures?
Add namespace-manager
replace file:file-to-byte-array-transformer
with byte-array-to-string-transformer
fix xpath usage
updated code:
<mule xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:email="http://www.mulesoft.org/schema/mule/email"
xmlns:pop3="http://www.mulesoft.org/schema/mule/pop3" 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/pop3 http://www.mulesoft.org/schema/mule/pop3/current/mule-pop3.xsd
http://www.mulesoft.org/schema/mule/email http://www.mulesoft.org/schema/mule/email/current/mule-email.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd">
<mulexml:namespace-manager
includeConfigNamespaces="true">
<mulexml:namespace prefix="ns0"
uri="http://www.example.com/something.xsd" />
</mulexml:namespace-manager>
<flow name="email_notificationFlow">
<file:inbound-endpoint path="C:\Users\pd00h\Desktop\Knauf\testxML"
responseTimeout="10000" doc:name="File" />
<byte-array-to-string-transformer
doc:name="Byte Array to String" />
<set-variable variableName="order"
value="#[xpath3('//ns0:WhsDockets/ns0:WhsDocket/ns0:Reference')]"
doc:name="Variable" />
<logger message="#[flowVars.order]" level="INFO" doc:name="Logger" />
<file:outbound-endpoint path="C:\Users\pd00h\Desktop\Knauf"
outputPattern="Knauf-#[message.id].xml" responseTimeout="10000"
doc:name="File" />
</flow>
</mule>
Sample xml file:
<?xml version='1.0' encoding='UTF-8'?>
<ns0:WhsDockets xmlns:ns0="http://www.example.com/something.xsd">
<ns0:WhsDocket>
<ns0:Reference>GotIt!</ns0:Reference>
</ns0:WhsDocket>
</ns0:WhsDockets>
Cheers
I am trying to deploy a mule app on mule standalone 3.7.0 EE, but
when running I occur this error: cvc-complex-type.2.4.a: Invalid content was found starting with element 'dw:transform-message'
This is my flow:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:magento="http://www.mulesoft.org/schema/mule/magento" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:json="http://www.mulesoft.org/schema/mule/json" 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/magento http://www.mulesoft.org/schema/mule/magento/current/mule-magento.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<magento:config name="Magento" username="test" password="test" address="http://127.0.0.1:8000/api/v2_soap/" doc:name="Magento"/>
<flow name="proFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="test" doc:name="HTTP"/>
<magento:get-order config-ref="Magento" orderId="100000000" doc:name="Magento"/>
<dw:transform-message doc:name="Transform Message">
<dw:set-payload><![CDATA[%dw 1.0
%output application/json
---
{
orderId: payload.increment_id
}]]></dw:set-payload>
</dw:transform-message>
<set-payload value="#[payload]" doc:name="Set Payload"/>
</flow>
</mule>
also, I have this dependency in pom.xml:
<dependency>
<groupId>com.mulesoft.weave</groupId>
<artifactId>mule-plugin-weave_2.11</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
Looks like you are missing this schema locations:
http://www.mulesoft.org/schema/mule/ee/dw
http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
Try to add it in xsi:schemaLocation list.
Hope this helps
Regards
I am trying to run in Anypoint Studio a project with maven using magento connector ver 2.2.0.
This is my project's xml file:
<mule xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:magento="http://www.mulesoft.org/schema/mule/magento" 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/magento http://www.mulesoft.org/schema/mule/magento/current/mule-magento.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<magento:config name="Magento" username="test" password="test$" address="http://127.0.0.1:8000.com/api/v2_soap/" doc:name="Magento"/>
<flow name="magentoFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/magento" doc:name="HTTP"/>
<magento:get-product config-ref="Magento" doc:name="Magento" productId="1"/>
<json:object-to-json-transformer doc:name="Object to JSON"/>
</flow>
</mule>
and this is the error:
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'magento:config'. One of '{"http://www.springframework.org/schema/beans":beans, "http://www.springframework.org/schema/beans":bean, "http://www.springframework.org/schema/context":property-placeholder, "http://www.springframework.org/schema/beans":ref, "http://www.mulesoft.org/schema/mule/core":global-property, "http://www.mulesoft.org/schema/mule/core":configuration, "http://www.mulesoft.org/schema/mule/core":notifications, "http://www.mulesoft.org/schema/mule/core":abstract-extension, "http://www.mulesoft.org/schema/mule/core":abstract-shared-extension, "http://www.mulesoft.org/schema/mule/core":abstract-mixed-content-extension, "http://www.mulesoft.org/schema/mule/core":abstract-agent, "http://www.mulesoft.org/schema/mule/core":abstract-security-manager, "http://www.mulesoft.org/schema/mule/core":abstract-transaction-manager, "http://www.mulesoft.org/schema/mule/core":abstract-shared-transaction-manager, "http://www.mulesoft.org/schema/mule/core":abstract-connector, "http://www.mulesoft.org/schema/mule/core":abstract-shared-connector, "http://www.mulesoft.org/schema/mule/core":abstract-global-endpoint, "http://www.mulesoft.org/schema/mule/core":abstract-exception-strategy, "http://www.mulesoft.org/schema/mule/core":abstract-flow-construct, "http://www.mulesoft.org/schema/mule/core":flow, "http://www.mulesoft.org/schema/mule/core":sub-flow, "http://www.mulesoft.org/schema/mule/core":abstract-model, "http://www.mulesoft.org/schema/mule/core":abstract-interceptor-stack, "http://www.mulesoft.org/schema/mule/core":abstract-filter, "http://www.mulesoft.org/schema/mule/core":abstract-transformer, "http://www.mulesoft.org/schema/mule/core":processor-chain, "http://www.mulesoft.org/schema/mule/core":custom-processor, "http://www.mulesoft.org/schema/mule/core":abstract-empty-processor, "http://www.mulesoft.org/schema/mule/core":invoke, "http://www.mulesoft.org/schema/mule/core":set-payload, "http://www.mulesoft.org/schema/mule/core":abstract-global-intercepting-message-processor, "http://www.mulesoft.org/schema/mule/core":custom-queue-store, "http://www.mulesoft.org/schema/mule/core":abstract-processing-strategy}' is expected.
What's missing?
Does the following work?
<?xml version="1.0" encoding="UTF-8"?>
<mule
xmlns:json="http://www.mulesoft.org/schema/mule/json"
xmlns:magento="http://www.mulesoft.org/schema/mule/magento"
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/3.7/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.7/mule-http.xsd
http://www.mulesoft.org/schema/mule/magento http://www.mulesoft.org/schema/mule/magento/1.2/mule-magento.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/3.7/mule-json.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<magento:config name="Magento" username="test" password="test$" address="http://127.0.0.1:8000.com/api/v2_soap/" doc:name="Magento"/>
<flow name="magentoFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/magento" doc:name="HTTP"/>
<magento:get-product config-ref="Magento" doc:name="Magento" productId="1"/>
<json:object-to-json-transformer doc:name="Object to JSON"/>
</flow>
</mule>
Changes from your snippet:
Added the XML declaration line
Changed the location of the XSDs to specific versions instead of 'current'.
(Am not sure if this is needed since the XSDs might be coming from jars on the classpath)
trying to implement the Durable feature on a Topic consumer.
Placed a name to the jms consumer and also clientID. (Obviously added the durable="true")
Now as far as i've read. The Topic will register the consumer as "durable" when it gets running for the first time.
So basically i did this, deployed the producer and consumer. It gets registered as a durable consumer. Publish a message to the topic, the consumer gets it. Now i undeploy the consumer and publish another message the consumer should be receive whenever gets up. When I deploy the consumer again, i get the common temp-topic://XXXXXXXXXXXX destination doesn't exist.
Why is this happening? Shouldn't i be getting the "lost" message?
This is my current jms activemq connector configuration for the publisher:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:jbossts="http://www.mulesoft.org/schema/mule/jbossts" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" version="CE-3.3.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.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/jbossts http://www.mulesoft.org/schema/mule/jbossts/current/mule-jbossts.xsd ">
<jms:activemq-connector name="Active_MQ" specification="1.1" brokerURL="tcp://localhost:61616" validateConnections="false" doc:name="Active MQ" maxRedelivery="1" persistentDelivery="true" durable="true" clientId="RoutingTopic">
<reconnect count="5" />
</jms:activemq-connector>
<message-properties-transformer name="MessagePropertiesTransformer" doc:name="Message Properties" overwrite="true">
<add-message-property key="BACKEND_SUBSCRIBER" value="#[flowVars['backend']]"/>
<add-message-property key="MULE_EVENT_TIMEOUT" value="60000"/>
</message-properties-transformer>
<flow name="jmsFlow1" doc:name="jmsFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="jms" doc:name="HTTP"/>
<set-variable variableName="#['id']" value="#[message.inboundProperties['id']]" doc:name="set dynamic id"/>
<set-variable variableName="#['backend']" value="#[message.inboundProperties['backend']]" doc:name="setting backend"/>
<set-payload value="#['This is a message test for id '] #[flowVars['id']]" doc:name="set random string as payload"/>
<choice doc:name="Choice">
<when expression="#[true]">
<processor-chain>
<jms:outbound-endpoint exchange-pattern="request-response" connector-ref="Active_MQ" doc:name="JMS Topic Requestor" transformer-refs="MessagePropertiesTransformer" topic="ESB.Topic">
</jms:outbound-endpoint>
</processor-chain>
</when>
<otherwise>
<processor-chain>
<logger message="This is the default case" level="INFO" doc:name="Logger"/>
</processor-chain>
</otherwise>
</choice>
</flow>
</mule>
This is one of the consumers, i got 2, but both are basically the same thing
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:jbossts="http://www.mulesoft.org/schema/mule/jbossts" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" version="CE-3.3.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.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/jbossts http://www.mulesoft.org/schema/mule/jbossts/current/mule-jbossts.xsd ">
<jms:activemq-connector name="UpCity_Connector" specification="1.1" brokerURL="tcp://localhost:61616" validateConnections="false" maxRedelivery="0" doc:name="Active MQ" clientId="RandomName" durable="true"/>
<flow name="jmsAdapterConsumerFlow1" doc:name="fmsAdapterConsumerFlow1">
<jms:inbound-endpoint exchange-pattern="request-response" connector-ref="UpCity_Connector" doc:name="JMS Replier Consumer" topic="ESB.Topic">
<jms:selector expression="BACKEND_SUBSCRIBER='randombackend'"/>
</jms:inbound-endpoint>
<set-payload value="#[payload + ' returned from a random backend']" doc:name="Add string to payload"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
</flow>
</mule>
Thanks.
Durable Messaging is a little tricky in JMS, as your config/code will have to meet several criteria to get this to work correctly:
enable persistence in your broker's config (in ActiveMQ this is either done in the connection string as David posted, or in your configuration xml
create a durable subscriber (ActiveMQ API)
I'm not sure that mule creates durable subscribers. However, you can check that in ActiveMQ's web console. There you can get a list of the current durable subscriptions.