0
votes

--NOTE: Mule and AnyPoint Studio newby... :-)

Trying to create a simple listener on "devQueue1" that - upon receiving a message - writes to "devQueue2".

Is there something fundamentally wrong with the configuration? --Seems either that "devQueue2" is not being written to... -Or, that "devQueue2" cannot be reached(?).

Wondering if there is anything in Windows 10 environment that could be -preventing access(???). Confusing and frustrating - as the simple scenario/configuration appears straight forward.

Any help/hints/direction appreciated!!

Thx! sd

get the following error each time I submit a string message on ActiveMQ queue: "devQueue1"...

ERROR 2019-09-10 12:28:23,469 [[MuleRuntime].cpuLight.13: [muleamq05].muleamq05Flow.CPU_LITE @72b26d13] [event: ] org.mule.runtime.core.internal.exception.OnErrorPropagateHandler: 
********************************************************************************
Message               : Failed to retrieve a Message. Operation timed out after 10000 milliseconds.
Error type            : JMS:TIMEOUT
Element               : muleamq05Flow/processors/0 @ muleamq05:muleamq05.xml:25 (Consume)
Element XML           : <jms:consume doc:name="Consume" doc:id="840110c3-031e-4c06-8d42-d7f08700c0ca" config-ref="JMS_Config" destination="devQueue2" ackMode="IMMEDIATE" contentType="application/json" encoding="UTF-8">
<jms:consumer-type>
<jms:queue-consumer></jms:queue-consumer>
</jms:consumer-type>
</jms:consume>

  (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

WARN  2019-09-10 12:28:23,473 [ActiveMQ Session Task-2] [event: ] org.mule.jms.commons.internal.source.push.JmsMessageListener: An error occurred processing the message, returning it to the queue
org.mule.runtime.api.exception.MuleRuntimeException: org.mule.jms.commons.api.exception.JmsTimeoutException: Failed to retrieve a Message. Operation timed out after 10000 milliseconds
Caused by: org.mule.jms.commons.api.exception.JmsTimeoutException: Failed to retrieve a Message. Operation timed out after 10000 milliseconds
Caused by: org.mule.runtime.api.exception.MuleRuntimeException: Failed to retrieve a Message. Operation timed out after 10000 milliseconds

message flow

enter image description here

configuration.xml (simple listener and queue configuration)

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:jms="http://www.mulesoft.org/schema/mule/jms" 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/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd">
    <jms:config name="JMS_Config" doc:name="JMS Config" doc:id="a0ce686e-e63a-4983-b369-31210ef5704b" >
        <jms:active-mq-connection username="admin" password="admin" clientId="client001">
            <jms:factory-configuration brokerUrl="tcp://localhost:61616"/>
        </jms:active-mq-connection>
    </jms:config>
    <flow name="muleamq05Flow" doc:id="d662e3af-7f70-468e-88ac-6a92803cb2ca" initialState="started" maxConcurrency="1">
        <jms:listener doc:name="Listener" doc:id="4968c8e3-0559-4290-bee1-46a89d513288" config-ref="JMS_Config" destination="devQueue1" ackMode="DUPS_OK" inboundContentType="application/json" inboundEncoding="UTF-8">
            <jms:consumer-type >
                <jms:queue-consumer />
            </jms:consumer-type>
            <jms:response persistentDelivery="true">
                <jms:body ><![CDATA[#[%dw 2.0
output application/json
---
payload.AAAAA]]]></jms:body>
                <jms:reply-to destination="devQueue2" />
            </jms:response>
        </jms:listener>
        <jms:consume doc:name="Consume" doc:id="840110c3-031e-4c06-8d42-d7f08700c0ca" config-ref="JMS_Config" destination="devQueue2" ackMode="IMMEDIATE">
            <jms:consumer-type >
                <jms:queue-consumer />
            </jms:consumer-type>
        </jms:consume>
    </flow>
</mule>

QUESTION: why is the listener not forwarding received message to "devQueue2"

pom.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.mycompany</groupId>
    <artifactId>muleamq05</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>mule-application</packaging>

    <name>muleamq05</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <app.runtime>4.2.1</app.runtime>
        <mule.maven.plugin.version>3.2.7</mule.maven.plugin.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.mule.tools.maven</groupId>
                <artifactId>mule-maven-plugin</artifactId>
                <version>${mule.maven.plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                <sharedLibraries>
                        <sharedLibrary>
                            <groupId>org.apache.activemq</groupId>
                            <artifactId>activemq-client</artifactId>
                        </sharedLibrary>
                    </sharedLibraries>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.mule.connectors</groupId>
            <artifactId>mule-http-connector</artifactId>
            <version>1.5.6</version>
            <classifier>mule-plugin</classifier>
        </dependency>
        <dependency>
            <groupId>org.mule.connectors</groupId>
            <artifactId>mule-sockets-connector</artifactId>
            <version>1.1.5</version>
            <classifier>mule-plugin</classifier>
        </dependency>
        <dependency>
            <groupId>org.mule.connectors</groupId>
            <artifactId>mule-jms-connector</artifactId>
            <version>1.6.2</version>
            <classifier>mule-plugin</classifier>
        </dependency>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-client</artifactId>
            <version>5.15.4</version>
        </dependency>
    </dependencies>

    <repositories>
          <repository>
            <id>anypoint-exchange</id>
            <name>Anypoint Exchange</name>
            <url>https://maven.anypoint.mulesoft.com/api/v1/maven</url>
            <layout>default</layout>
        </repository>
        <repository>
            <id>mulesoft-releases</id>
            <name>MuleSoft Releases Repository</name>
            <url>https://repository.mulesoft.org/releases/</url>
            <layout>default</layout>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>mulesoft-releases</id>
            <name>mulesoft release repository</name>
            <layout>default</layout>
            <url>https://repository.mulesoft.org/releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

</project>

Environment

Version: 7.3.5 Build Id: 201909031749

Mule runtime version: 4.2.1

Mule plugin version: 3.2.7

ActiveMQ version: 5.15.9

Jdk version: 1.8

2

2 Answers

0
votes

You are getting the JMS:TIMEOUT error because of the <jms:consume> operation reading queue devQueue2 didn't find any messages to read, within the timeout specified in the operation, at execution time. Basically the queue is empty, there is nothing to read.

That's unrelated to a possible datasense issue at design time.

0
votes

For any stumbling thru Mule (and Anypoint Studio) as a newby - like myself (he said sheepishly) - the simple solution was to replace the "consume" type queue widget with the "publish" type queue widget...

i.e.,

enter image description here

...and here is the updated Mule config xml,

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
    xmlns:jms="http://www.mulesoft.org/schema/mule/jms" 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/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
    <jms:config name="JMS_Config" doc:name="JMS Config"
        doc:id="860c7313-b56b-4594-a49f-e58fef7c6bbd">
        <jms:active-mq-connection username="admin"
            password="admin">
            <jms:caching-strategy>
                <jms:default-caching />
            </jms:caching-strategy>
            <jms:factory-configuration brokerUrl="tcp://localhost:61616" />
        </jms:active-mq-connection>
        <jms:consumer-config>
            <jms:consumer-type>
                <jms:queue-consumer />
            </jms:consumer-type>
        </jms:consumer-config>
    </jms:config>
    <flow name="muleamq04Flow" doc:id="e22c256f-b0f8-405b-8abe-2b7f16be3257">
        <jms:listener doc:name="Listener" destination="devQueue1"
            doc:id="860c7313-b56b-4594-a49f-e58fef7c6bbd" config-ref="JMS_Config"
            ackMode="DUPS_OK">
            <jms:response sendCorrelationId="NEVER" sendContentType="false"
                sendEncoding="false" />
        </jms:listener>
        <jms:publish doc:name="Publish" doc:id="60fa045c-d734-482c-bb9c-9f0491b710e8" config-ref="JMS_Config" destination="devQueue2"/>
    </flow>
</mule>