Skip to main content

#Payload0 debatiendo

Here is my flow

 

I tried to acknowledged but having "The Consumer is closed " error

 Flow :

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

 <mule xmlns:jms="http://www.mulesoft.org/schema/mule/jms" 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

 

http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd">

 

<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="89e0f34b-6b83-4776-99d1-080637d3150b" >

 

<http:listener-connection host="0.0.0.0" port="8081" />

 

</http:listener-config>

 

<jms:config name="JMS_Config" doc:name="JMS Config" doc:id="e8e28a6d-297f-43ae-8f73-699b80d70980" >

 

<jms:active-mq-connection username="admin" password="******" >

 

<jms:caching-strategy >

 

<jms:no-caching />

 

</jms:caching-strategy>

 

<jms:factory-configuration brokerUrl="tcp://localhost:61616" />

 

</jms:active-mq-connection>

 

<expiration-policy maxIdleTime="1000000" timeUnit="MILLISECONDS" />

 

<jms:producer-config timeToLive="100000" />

 

</jms:config>

 

<flow name="consumemessageactivemqFlow" doc:id="d4448da9-afad-46c4-b328-7cf25fcb70e5" >

 

<http:listener doc:name="Listener" doc:id="7af095a3-903b-4cef-bcea-c04744cd8ce9" config-ref="HTTP_Listener_config" path="/consume"/>

 

<jms:consume doc:name="Consume" doc:id="0ed7c1f3-56e8-4a93-9ab6-e0e3c852eb03" config-ref="JMS_Config" destination="test1" ackMode="MANUAL" maximumWait="100000" transactionalAction="NOT_SUPPORTED" target="test" targetValue="#message">

 

<reconnect-forever />

 

<jms:consumer-type >

 

<jms:queue-consumer />

 

</jms:consumer-type>

 

</jms:consume>

 

<logger level="INFO" doc:name="Logger" doc:id="4b81f117-0b1e-490a-a681-dc07b78b7bea" message="#payload"/>

 

<jms:ack doc:name="Ack" doc:id="f1f780d8-67ac-4859-963c-8c9c9edbfc90" ackId="#vars.test.attributes.ackId" />

 

</flow>

 

</mule>

 

 Exception:

 

INFO 2021-04-10 09:39:37,390 [[MuleRuntime].uber.03: [consumemessageactivemq].consumemessageactivemqFlow.CPU_LITE @10875769] [processor: consumemessageactivemqFlow/processors/1; event: 907642f0-99b2-11eb-b7f5-7c76357e16b6] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: 

 

ERROR 2021-04-10 09:39:37,496 [[MuleRuntime].uber.03: [consumemessageactivemq].consumemessageactivemqFlow.CPU_LITE @10875769] [processor: consumemessageactivemqFlow/processors/2; event: 907642f0-99b2-11eb-b7f5-7c76357e16b6] org.mule.runtime.core.internal.exception.OnErrorPropagateHandler: 

 

********************************************************************************

 

Message    : The Consumer is closed

 

Element    : consumemessageactivemqFlow/processors/2 @ consumemessageactivemq:consumemessageactivemq.xml:30 (Ack)

 

Element DSL   : <jms:ack doc:name="Ack" doc:id="f1f780d8-67ac-4859-963c-8c9c9edbfc90" ackId="#vars.test.attributes.ackId"></jms:ack>

 

Error type   : MULE:UNKNOWN

 

FlowStack    : at consumemessageactivemqFlow(consumemessageactivemqFlow/processors/2 @ consumemessageactivemq:consumemessageactivemq.xml:30 (Ack)

22 respuestas
  1. 17 abr 2021, 08:07

    Ok you mean empty

    because it has only 2 options immediate and manual

    but why for manual type ack activity giving such erro

0/9000

Input json:

 

[{ email: "abcb@hcl.com", status : "NO Id Avalible" }, { email: "kharathi@hcl.com", status : "ID Avalible" }]

 

I need to generate html table response like below in dataweave 1. Can anyone help on this.

 

Expected Response:

<html><body><table border=1 cellpadding=1 cellspacing=1 style=width:500px> <tbody> <tr> <td style=text-align: center;>&nbsp;Email Id</td> <td style=text-align: center;>&nbsp;Update Status</td> </tr> <tr> <td>EMAIL</td> <td>STATUS</td> </tr></body></html> 

5 respuestas
  1. 17 ene 2020, 04:39

    Thanks @Rohit Reddy for your response.​ .

     

    But i am facing issue while implementing solution this into Dataweave.

     

    Message        : Exception while executing: 

              td @(style:"text-align: center;"): $.status,

                                ^

    Type mismatch for 'Value Selector' operator

       found :string, :name

     required :datetime, :name or

     required :localdatetime, :name or

     required :object, :name or

     required :time, :name or

     required :array, :name or

     required :date, :name or

     required :localtime, :name or

     required :period, :name.

    Payload        : { "email": "abcb@hcl.com", "status" : "NO Id Avalible" }

    Payload Type     : java.lang.String

     

    Flow XML is: [Attached XML file]

     

    <flow name="testerappFlow">

        <poll doc:name="Poll">

          <fixed-frequency-scheduler frequency="1" timeUnit="MINUTES"/>

          <set-payload value="{ "email": "abcb@hcl.com", "status" : "NO Id Avalible" }" doc:name="Set Payload"/>

        </poll>

        <set-variable variableName="payloadVar" value="#[]" doc:name="Variable"/>

        <expression-component doc:name="Expression"><![CDATA[flowVars.payloadVar.add(payload);]]></expression-component>

        <logger message="#flowVars ---- payload: #payload" level="INFO" doc:name="Logger"/>

        <dw:transform-message doc:name="Transform Message" metadata:id="8aad28c5-b6fd-456f-b409-870e8f92b1e5">

          <dw:input-variable doc:sample="sample_data\string_1.dwl" variableName="payloadVar"/>

          <dw:set-payload><![CDATA[%dw 1.0

    %output application/xml

    ---

    html :

      body :

        table @(border:1,cellpadding:1,

        cellspacing:1,style:"width:500px"):

          tbody : 

            tr : {

              td @(style:"text-align: center;"): "Email Id",

              td @(style:"text-align: center;"): "Update Status"

            } ++

            {(flowVars.payloadVar map {

            

              td @(style:"text-align: center;"): $.status,

              td @(style:"text-align: center;"): $.email

        

         }

            )}

            ]]></dw:set-payload>

        </dw:transform-message>

        <logger message="payload at End: #payload" level="INFO" doc:name="Logger"/>

      </flow>

0/9000

We don't have error on the destination?

**********************************************************

Message               : Client connection was closed.

Element               : xxx-papi-main/source @ papi-yyyy-xxx:xxx-papi.xml:9

Element XML           : <http:listener config-ref="HTTP_Listener_Config" path="${http.listener.path}">

                        <http:response statusCode="#vars.httpStatus default 200">

                        <http:headers>#vars.outboundHeaders default {}</http:headers>

                        </http:response>

                        <http:error-response statusCode="#vars.httpStatus default 500">

                        <http:body>#payload</http:body>

                        <http:headers>#vars.outboundHeaders default {}</http:headers>

                        </http:error-response>

                        </http:listener>

Error type            : MULE:SOURCE_RESPONSE_SEND

Payload Type          : org.mule.runtime.core.internal.streaming.bytes.ManagedCursorStreamProvider

**********************************************************

 

Thank's for help.

9 respuestas
  1. 17 feb 2021, 19:00

    Thanks much. Will work with them on this.

0/9000

I'm trying to fetch records from MongoDB with "Execute Command" and code snippet as below and ISO date feature is not working. Let me know alternate solution to execute below DW .

%dw 2.0

 

import * from dw::core::Periods

 

output application/json

 

---

 

{

 

"aggregate": "User",

 

"pipeline": [

 

{

 

"\$match": {

 

"created_at": {

 

"\$gte": 'ISODate(' ++(now() - |P1D| - minutes(5)) ++ ')' as String {

 

"format": "yyyy-MM-dd'T'hh:mm:ss'Z'"

 

}

 

}

 

}

 

}],

 

"cursor": {

 

}

 

}

7 respuestas
  1. 21 nov 2024, 17:18

    @Jjj Rock​ 

    I have achieved this without using any execute command using ISO date format as follows, ISO date format is working in mongo if we send in proper format as follows where "date_modified" is my field name in mongodb

     

    Transform Payload for the mongo query:

    {

     "\$expr": {

      "\$gte": [

       "\$date_modified",

       { "\$toDate": "2024-11-20T11:56:14.000+00:00" }

      ]

     }

    }

     

    sample flow which is working as follows :

    <flow name="GetRecordsWithDate" doc:id="3a18e2ea-466b-4d30-ab26-dc56e1e8b910">

    <scheduler doc:name="Scheduler" doc:id="aae27461-6164-46b0-8818-06a6dc41024c">

    <scheduling-strategy>

    <fixed-frequency timeUnit="HOURS" />

    </scheduling-strategy>

    </scheduler>

    <ee:transform doc:name="Transform Message" doc:id="dc2bd055-977e-4133-ae6b-2b37d42cb242" >

    <ee:message >

    <ee:set-payload ><![CDATA[%dw 2.0

    output application/json

    ---

    {

    "\$expr": { "\$gte": ["\$date_modified", { "\$toDate": '2024-11-20T11:56:14.000+00:00' } ] }

    }]]></ee:set-payload>

    </ee:message>

    </ee:transform>

    <mongo:find-documents doc:name="Find documents" doc:id="27734fbb-9669-4f33-bb92-96f26df51a3b" config-ref="MongoDB_Config" collectionName="collectionName" fields=",">

    <mongo:query ><![CDATA[#payload]]></mongo:query>

    </mongo:find-documents>

     

    <!-- Use DataWeave to extract distinct IDs -->

    <ee:transform doc:name="Transform Message" doc:id="2c99f8b6-1b2f-4ce9-b8b7-56086fbc28d5" >

    <ee:message >

    <ee:set-payload resource="transformations/distinct_avails_all_titles_alpha_rl_ids.dwl" />

    </ee:message>

    </ee:transform>

    </flow>

0/9000
5 respuestas
  1. 28 ago 2020, 17:20

    Hi @Michael Orechoff​ . I have just run across a similar issue. I see this in the logs:

    Failed to get procedure types with schema MULESOFTFA, package MS_BUSNS_TRAN_PKG and procedure DO_CREATE. Removing all catalog and schema filters.

    Then get this error:

    errorType: {

        identifier: "QUERY_EXECUTION",

        parentErrorType: {

          identifier: "ANY",

          parentErrorType: null,

          namespace: "MULE"

        },

        namespace: "DB"

      },

      childErrors: [],

      errorMessage: null,

      cause: {

        localizedMessage: "Invalid conversion requested",

        cause: {

          localizedMessage: "Invalid conversion requested",

          errorCode: 17132,

          cause: null,

          message: "Invalid conversion requested",

          SQLState: "99999",

    Sounds similar to yours. Did Mulesoft give you any kind of timeframe?

0/9000

Hi All,

 

I'm getting data as the following CSV with comma(,) separator where the EmployeeInformation is in JSON format

 

Name,Date,EmployeeInformation

DEF,2022-05-15,NULL

MNO,2022-04-31,NEWLY GRADUATED

ABC,2022-06-21,{"Previouscompany":"xyz","ID":"12345","department":"IT Communications","salary":"25000"}

 

and we have to populate the output in CSV format but with '|' separator

 

and the expected output should be like the following (the entire JSON data should be in one column)

 

Name,Date,EmployeeInformation

DEF|2022-05-15|NULL

MNO|2022-04-31|NEWLY GRADUATED

ABC|2022-06-21|{"Previouscompany":"xyz","ID":"12345","department":"IT Communications","salary":"25000"}

 

Thanks in Advance

23 respuestas
  1. 21 jun 2022, 13:13

    Hi @Phani Kakuleti​ !

     

    Do you know if it's possible to ask the source of the csv to escape the "," in the file they send you

    Because if they can something like this:

    Hi @Phani Kakuleti​ ! Do you know if it's possible to ask the source of the csv to escape the 

    It will simplify the required DWL to solve the issue:

     

    image 

    And if that's not possible, then you need to process the csv as a string and perform the following operations:

    image 

    %dw 2.0

    output application/csv separator='|'

    var replacedPayload = payload replace '","' with '"\,"'

    var parsedPayload= read(replacedPayload, 'application/csv')

    ---

    parsedPayload

     

    Hope it helps!

     

    Good luck!!

     

    Juan Cruz Basso

0/9000

How accumulate payload in this subflow?

<sub-flow name="declaration-gen-bdxSub_Flow" doc:id="4a053275-e3a0-4d7f-9a2e-a1d4a2df55dd" >

<foreach doc:name="For Each" doc:id="ec657e3d-2621-4c5b-a19e-108b96ad765d" >

<db:select doc:name="Select" doc:id="86b58687-f81b-461c-99cc-1980b43e8f52" config-ref="Database_Config" target="record_emo_id">

<db:sql><![CDATA[SELECT COUNT(*) as Occurrences

FROM SOCLESI_DEV.FLUX_RECEPT.EMO_DECLARATION

WHERE SUBSTRING(EMO_ID, 1, 11) = :EMO_ID]]></db:sql>

<db:input-parameters><![CDATA[#[{

EMO_ID: payload.Reference

}]]]></db:input-parameters>

</db:select>

<logger level="INFO" doc:name="Logger" doc:id="5cfe5250-e08d-44cb-9fe0-cbb9080606f0" message="#vars.record_emo_id[0.Occurrences]" />

<ee:transform doc:name="Transform Message" doc:id="f7492f10-1dc7-44ff-8e57-b7550dfef4f3">

<ee:message>

<ee:set-payload><![CDATA[%dw 2.0

output application/json

var occurenceVal=vars.record_emo_id[0].Occurrences

fun incrementId(id, occurenceVal) =

id ++ "0" ++ occurenceVal +1 as String

fun formatDate(inputDate: String): String =

inputDate[0 to 9] replace "-" with ""

---

{

Intitule: "declaration",

Reference: incrementId(payload.Reference,occurenceVal),

Numero_etude: payload.Numero_etude,

Date_debut: payload.Date_debut,

Date_fin: payload.Date_fin,

Date_exigibilite: payload.Date_exigibilite,

Date_mise_en_demeure: payload.Date_mise_en_demeure,

Date_saisie: null,

Date_generation: null,

Code_saisie: "A",

Siret: null,

Nb_creance: "01",

Nb_reduction: null,

Moyen_payement: null,

Montant_cotisation: null,

Montant_reduction: null,

Intitule: "creancegeneral",

Code_saisie: "A",

Type_creance: "EM01",

Periode: payload.Periode,

Code_regime: payload.Code_regime,

Taux: null,

Taux_emolument: "004.00",

Montant_base: "0.00",

Montant_cotisation1: null,

vide_1: null,

vide_2: null,

Montant_cotisation2: null,

Sens_du_montant: null

}]]></ee:set-payload>

</ee:message>

<ee:variables>

</ee:variables>

</ee:transform>

<ee:transform doc:name="Transform Message" doc:id="6896184b-b2e4-4053-848d-33b49ceaacc5">

<ee:message>

<ee:set-payload><![CDATA[%dw 2.0

output application/csv header = false, separator = ";"

---

[payload] flatMap ((item, index) -> [{

Intitule: "declaration",

Reference: payload.Reference,

Numero_etude: payload.Numero_etude,

Date_debut: payload.Date_debut,

Date_fin: payload.Date_fin,

Date_exigibilite: payload.Date_exigibilite,

Date_mise_en_demeure: payload.Date_mise_en_demeure,

Date_saisie: null,

Date_generation: null,

Code_saisie: "A",

Siret: null,

Nb_creance: "01",

Nb_reduction: null,

Moyen_payement: null,

Montant_cotisation: null,

Montant_reduction: null

},{

Intitule: "creancegeneral",

Code_saisie: "A",

Type_creance: "EM01",

Periode: payload.Periode,

Code_regime: payload.Code_regime,

Taux: null,

Taux_emolument: "004.00",

Montant_base: "0.00",

Montant_cotisation1: null,

vide_1: null,

vide_2: null,

Montant_cotisation2: null,

Sens_du_montant: null

}] )]]></ee:set-payload>

</ee:message>

</ee:transform>

</foreach>

<logger level="INFO" doc:name="Logger" doc:id="83d5a592-2018-49ef-82ab-c832a2aafe0d" message="#payload"/>

</sub-flow>

 

accumulate payload

2 respuestas
  1. 22 feb 2024, 02:26

    Hi @Hichem Rtibi​ ,

     

    Based on what I can understand from your code, you are walking through an array in the payload, using some information of each element to query the DB and to a transformation.

    If you want as a result, an array with each transformed element, you need to create an auxiliary variable in the flow, and before finishing the for each append the result you are looking for.

    Check this flow:

    Hi @Hichem Rtibi​ , Based on what I can understand from your code, you are walking through an array in the payload, using some information of each element to query the DB and to a transformation.In the first processor you need to initialize the auxiliar variable as an empty array with []. Be aware, after doing the processing logic, you have to set the auxiliar variable again. I this sample I used the transform processor and append the result of my transformation to the array.

     

    Hope it helps.

     

    Good luck!

    Juan Cruz Basso

0/9000
2 respuestas
  1. 18 may 2022, 13:41

    Hi @prajwal M R​ !

     

    You can re utilize the xslt you have already, but you need to be aware to provide all the libraries or replace them.

     

    Here is a basic usage of it and I'm also attaching the updated xslt that worked for me:

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

     

    <mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:xml-module="http://www.mulesoft.org/schema/mule/xml-module"

    xmlns:vm="http://www.mulesoft.org/schema/mule/vm"

    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/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd

    http://www.mulesoft.org/schema/mule/xml-module http://www.mulesoft.org/schema/mule/xml-module/current/mule-xml-module.xsd

    http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">

    <flow name="simple-testFlow" doc:id="99235cf9-33ce-4aa9-8f8a-aeb5e9f4a935" >

    <scheduler doc:name="Scheduler" doc:id="0f62fff3-b06a-4d80-a469-b99351e4f161" >

    <scheduling-strategy >

    <fixed-frequency timeUnit="MINUTES"/>

    </scheduling-strategy>

    </scheduler>

    <ee:transform doc:name="Transform Message" doc:id="2a506544-cff4-463c-ae2a-171e47a85bba" >

    <ee:message >

    <ee:set-payload ><![CDATA[%dw 2.0

    output application/xml

    ---

    {

    root:

    {

    targetSample : 'TargetValue',

    senderSample : 'SenderValue'

    }

    }]]></ee:set-payload>

    </ee:message>

    </ee:transform>

    <xml-module:xslt-transform doc:name="Xslt transform" doc:id="f9fc4bf1-22f3-4be8-97ca-c32d856eb6fb">

    <xml-module:xslt><![CDATA[${file::test.xslt}]]></xml-module:xslt>

    </xml-module:xslt-transform>

    <ee:transform doc:name="Transform Message" doc:id="594f3700-d013-417c-a781-5f5fa0c8ce75" >

    <ee:message >

    <ee:set-payload ><![CDATA[%dw 2.0

    output application/xml

    ---

    read(payload,'application/xml')]]></ee:set-payload>

    </ee:message>

    </ee:transform>

    <logger level="INFO" doc:name="Logger" doc:id="133d91b0-aa68-4553-b8d8-0880eff81feb" message="#payload"/>

    </flow>

    </mule>

    In this sample you will see that a scheduler is triggering the flow ( you can use any other) , and it's using from the XML module the xslt-transform processor . After the xslt is executed I added a transformation to get the xml otherwise, it's a plain string.

     

    Hope it help!

     

    Good luck!

     

    Juan Cruz Basso

0/9000
6 respuestas
  1. 28 jun 2022, 12:51

    Hi @Sudha 1​ ,

     

    Did you try closing the project and open it again? Or refreshing it? ( after adding the dependency )

     

    Did you try running the code ? Check if you still have the error when running a MUnit or the code.

     

    Hope it helps!

     

    Good luck!

    Juan Cruz Basso

0/9000

Hi All,

 

I am trying to add a file to sharepoint. If I give a relative url with a hardcoded filename then file is adding to sharepoint.

/Documents/new.txt

However If I give the relative url by reading filename through a variable

"/Documents/" ++ vars.fileName

 

I am getting below error

Message : Input type not supported yet.

com.mulesoft.connectors.sharepoint.internal.error.exception.SharepointException: Input type not supported yet.

 

Please help

6 respuestas
  1. 12 abr 2022, 18:40

    Hi Tulasi,

     

    It seems that the problem is not around the file name only.

     

    This is not right :

       <sharepoint:file-content-stream>#payload</sharepoint:file-content-stream>

     

    I think this one is correct:

    <sharepoint:file-add doc:name="File add" doc:id="4a0364bd-262c-4333-90f3-1151ab8bcd8f" config-ref="Sharepoint_Sharepoint_online" fileServerRelativeUrl="#['/Documents/' ++ vars.fileName]">

    <sharepoint:file-content-stream ><![CDATA[#payload]]></sharepoint:file-content-stream>

    </sharepoint:file-add>

     

    Good luck!

0/9000