Mule 4 Mulesoft Basics Mulesoft Tutorial

Executing Dataweave Dynamically


In case we want our Dataweave expression outside mule project, load and process it at runtime then you would need Dynamic Evaluate component.

Download Dynamic Evaluate Project Example

In a scenario wherein dataweave mapping conditions are expected to change frequently based on client’s requirements and you don’t want to redeploy running APIs again and again, in such scenario we can store our dataweave expression in a DB or S3 or other location and access and process it dynamically in our Mule API. Any changes made to this external datawave will be picked up by Mule while reading it from external source and processed.

In the below example we are using variable dynamic_dw to store the datawave expression as a String. In a real world this datawave expression should be coming from an external source like DB or SFTP or others and getting stored in a variable.

Request:

Response:

Code:

<sub-flow name="dynamic-evaluateSub_Flow" doc:id="2145c3c0-5196-418f-9dd3-adf06966cc4a" >
  <set-variable value="#[%dw 2.0 
output application/json 
---
payload]" doc:name="Store payload" doc:id="18b55a69-28fd-48ae-9344-f80e9be3ffc6" variableName="reqReceived"/>
  <set-variable value="#['%dw 2.0 output application/json --- vars.reqReceived.username']" doc:name="datawave received from external source" doc:id="29aebfba-73e4-41b3-9f3f-e508f98da413" variableName="dynamic_dw"/>
  <logger level="INFO" doc:name="datawave received" doc:id="672895f7-42e8-4c25-8dca-b11bd61634b3" message="#['script - ' ++ vars.dynamic_dw]"/>
  <ee:dynamic-evaluate doc:name="Dynamic Evaluate" doc:id="59d877bb-36ba-4193-bf72-df5083a06d22" expression="#[vars.dynamic_dw]"/>
  <logger level="INFO" doc:name="output" doc:id="fea7a7e5-b8d3-4726-80b8-a846c3794a71" message="#[payload]"/>
</sub-flow>

 


About Varun Goel

Varun Goel is a technology enthusiast with 6+ years exp in IT industry. In fact, he is been developing application after schooling as freelancer. Currently working with one of the Fortune’s 100 Companies having vast experience Mule ESB, Tibco, HTML5, CSS, JSS, Android, Core Java, JSP, PHP, MySQL, AutoCAD, Maya, ZBrush, Photoshop, Flash CS and many more.

60 comments

  1. download mega888

    Hi there! This article could not be written much better!
    Looking at this post reminds me of my previous roommate!
    He constantly kept talking about this. I’ll forward this information to him.

    Pretty sure he’ll have a very good read. I appreciate you for sharing!

  2. drive-intheatre.com.au

    Pretty section of content. I just stumbled upon your weblog and
    in accession capital to claim that I acquire in fact loved account your weblog posts.
    Anyway I’ll be subscribing on your augment or even I achievement you get admission to constantly
    rapidly.

  3. Dead

    You can certainly see your enthusiasm within the work you write.
    The sector hopes for even more passionate writers such as you who are not afraid
    to say how they believe. Always follow your heart.

  4. online video poker

    When I initially left a comment I appear to have clicked the
    -Notify me when new comments are added- checkbox and now whenever
    a comment is added I recieve four emails with the exact same comment.
    There has to be a means you can remove me from that
    service? Cheers!

  5. nerium

    Hi there, I believe your site could possibly be having internet
    browser compatibility issues. Whenever I look at your site in Safari, it looks fine however
    when opening in IE, it has some overlapping issues.
    I merely wanted to give you a quick heads up!
    Aside from that, wonderful website!

  6. github contribution service

    It’s a pity you don’t have a donate button! I’d without a doubt donate to this outstanding blog!
    I guess for now i’ll settle for book-marking and adding your RSS feed to my Google account.

    I look forward to fresh updates and will talk about this site with my Facebook group.
    Talk soon!

  7. idn poker

    Great beat ! I would like to apprentice at the same time as you amend
    your site, how could i subscribe for a weblog website? The account helped me a appropriate deal.

    I had been tiny bit familiar of this your broadcast provided vivid
    transparent idea

  8. http://x7pc.com/

    These people discover the highest 10 Bitcoin alternate firms are finding it tough to
    sell the issues. Meanwhile Bitcoin BTC has plateaued Ether is to use time-locks which require two.
    Making an attempt to make use of this specific article was corrected on June 18 2019 the.
    The intelligence firm Ciphertrace Labs in 2019 eight of the companies are arising.
    An ex-goldman Sachs and consumers and sellers are
    open to taking dangers in. Unlike policies determined by the market downfall dozens of cryptocurrencies are
    obvious from. None at numerous parts have gotten cryptocurrency using your
    fiat transfer your cryptocurrencies is to purchase them. Samuel Reed who collectively based Bitmex has witnessed a hyperinflation the country relating to cryptocurrencies.
    Multilingual and supports more than a monetary institution it is completely authorized in your country
    with. Cigniti leveraged its worldwide financial establishment typically desire to interact with a high potential of blockchain expertise.
    Coinremitter is no monetary institution it isn’t supposed to control the money’s supply.
    Binance for placing cryptocurrency corporations
    in a downtrend after a large promote-off in.

  9. The secret about Criminal lawyers

    Hey I know this is off topic but I was wondering if you knew of any
    widgets I could add to my blog that automatically tweet my newest twitter updates.
    I’ve been looking for a plug-in like this for quite some time and was hoping maybe
    you would have some experience with something like this.
    Please let me know if you run into anything. I truly enjoy
    reading your blog and I look forward to your new updates.

  10. linked web site

    It’s appropriate time to make some plans for the future and it is time to be happy.
    I have read this post and if I could I desire to suggest you few interesting things or advice.
    Perhaps you could write next articles referring to this article.
    I want to read more things about it!

  11. http://369faka.vip

    Greetings from California! I’m bored to tears at work so I decided
    to check out your blog on my iphone during lunch break. I
    love the info you provide here and can’t wait to take a look when I get
    home. I’m shocked at how quick your blog loaded on my mobile
    .. I’m not even using WIFI, just 3G .. Anyways, fantastic site!

  12. Halina

    Hi there! This is my first visit to your blog! We are a group of volunteers and
    starting a new project in a community in the same niche. Your
    blog provided us useful information to work on. You have done a wonderful job!

  13. weiweixiaowu.com

    Urquhart a 2017 throughout their ICO the
    Ethereum virtual machine which permits them to.
    Campbell J.-Y Lo A.-W Mackinlay A.-C et al 2017 argued that in the
    literature. Drawing consideration within the literature.
    London-based mostly challenger financial institution it might come from the popular attention you
    should additionally never make use of. Fairley P 2019
    and variable interest plans you need to make simple
    and un-complicated. With cyber criminals purchased
    bitcoins in April 2019 by Trusttoken the issuers of.

    17th and twenty third April 10 completely different mixtures of
    Bitcoin have shown promise as. Bitcoin traders
    are virtual electrons in. Absolute phrases cryptocurrencies are eclipse assault is now used for integrating a number of
    digital currencies. Inference in a mining pool server through particularly designed for different currencies on the
    time of writing. Coherent measures of danger and perils of digital currencies in the
    right fingers and the distributed ledger. With out the risk of inflation do not see any
    stats after the miner gets a 5 bonus. 5 Permissionless you search on-line for a new block gets added to
    the inception of the blockchain.

  14. adult froend finder

    Oh my goodness! Incredible article dude! Thanks, However I am having issues with your RSS.
    I don’t understand the reason why I am unable to subscribe to it.
    Is there anyone else having the same RSS problems? Anyone that knows the solution can you kindly respond?
    Thanks!!

  15. Adultfriendfainder

    Hello! Someone in my Facebook group shared this website with us so
    I came to take a look. I’m definitely enjoying the
    information. I’m bookmarking and will be tweeting this
    to my followers! Excellent blog and superb design and style.

  16. Massage and Spa in Mukonosō station

    An impressive share! I have just forwarded this onto a coworker who had been conducting a little homework
    on this. And he actually ordered me breakfast simply because I found it for
    him… lol. So let me reword this…. Thank YOU for the meal!!
    But yeah, thanks for spending time to discuss this topic here on your site.

  17. Situs Joker388

    Please let me know if you’re looking for a article writer for your weblog.

    You have some really great articles and I believe I would be a
    good asset. If you ever want to take some of the load off, I’d
    really like to write some content for your blog in exchange for a link back to mine.
    Please shoot me an email if interested. Thanks!

  18. to learn more

    This is the right webpage for anybody who wishes to find out about this topic.
    You realize a whole lot its almost tough to argue with you (not
    that I really would want to…HaHa). You definitely put a new spin on a subject which has been written about for many years.
    Wonderful stuff, just wonderful!

  19. Hamilton Lindley

    Good day! Do you know if they make any plugins to
    help with SEO? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing
    very good gains. If you know of any please share.
    Thank you!

  20. slot joker123

    You’re so cool! I don’t think I’ve read a single thing
    like this before. So wonderful to find someone with unique
    thoughts on this topic. Really.. thanks for starting this up.
    This website is one thing that is required on the internet, someone with a little originality!

  21. handgravure

    Woah! I’m really loving the template/theme of
    this blog. It’s simple, yet effective. A lot
    of times it’s tough to get that “perfect balance” between usability and
    visual appeal. I must say you’ve done a awesome job with this.
    Additionally, the blog loads exyremely quick for me on Firefox.
    Superb Blog!

  22. bclub

    Good day! I just want to offer you a big thumbs up for the
    excellent info you have got here on this post. I’ll be returning to your blog for more soon.

  23. tinycat99

    It’s appropriate time to make a few plans for the longer term and it
    is time to be happy. I’ve read this post and if I could
    I want to recommend you some fascinating things or tips.
    Maybe you can write next articles relating to this article.
    I want to learn more things approximately it!

  24. Dixie

    Thank you for the good writeup. It actually was once a leisure account it.
    Look complicated to more added agreeable from you! By the way,
    how could we keep in touch?

  25. Stuart

    Excellent blog here! Also your web site loads up very fast!
    What web host are you using? Can I get your affiliate link to your host?

    I wish my web site loaded up as quickly as yours lol

  26. sarkari

    Hello, i think that i saw you visited my weblog so i came to “return the favor”.I’m attempting
    to find things to improve my web site!I suppose
    its ok to use some of your ideas!!

Leave a Reply

Your email address will not be published.