Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mulesoft recuperando o TimeZone com groovy

Mulesoft recuperando o TimeZone com groovy

Mulesoft recuperando o TimeZone com groovy

Alex teles

August 07, 2016
Tweet

More Decks by Alex teles

Other Decks in Education

Transcript

  1. Conector groovy  Uso  Liguagem  Pegando o TimeZone

     Inserindo valor na variável no código groovy
  2. Xml do poll  <poll doc:name="Poll">  <schedulers:cron-scheduler expression="0 0

    1 1 * ? 2016"/>  <logger message="======= Iniciado ========" level="INFO" doc:name="Logger"/>  </poll>
  3. Código que recupera o time nove da Asia/Saigon  <scripting:component

    doc:name="Groovy">  <scripting:script engine="Groovy"><![CDATA[import groovy.time.TimeCategory   timeZone = TimeZone.getTimeZone('Asia/Saigon')  now = new Date()   flowVars ['dataTimeZone'] = now.format('dd/MM/yyyy HH:mm:ss.S',timeZone)]]></scripting:script>  </scripting:component>
  4.  <?xml version="1.0" encoding="UTF-8"?>  <mule xmlns:schedulers="http://www.mulesoft.org/schema/mule/schedulers" xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" 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/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule- scripting.xsd  http://www.mulesoft.org/schema/mule/schedulers http://www.mulesoft.org/schema/mule/schedulers/current/mule- schedulers.xsd">  <flow name="exemplo_groovy_timezoneFlow">  <poll doc:name="Poll">  <schedulers:cron-scheduler expression="0 0 1 1 * ? 2016"/>  <logger message="======= Iniciado ========" level="INFO" doc:name="Logger"/>  </poll>  <set-variable variableName="dataTimeZone" value="" doc:name="Variable"/>  <scripting:component doc:name="Groovy">  <scripting:script engine="Groovy"><![CDATA[import groovy.time.TimeCategory   timeZone = TimeZone.getTimeZone('Asia/Saigon')  now = new Date()   flowVars ['dataTimeZone'] = now.format('dd/MM/yyyy HH:mm:ss.S',timeZone)]]></scripting:script>  </scripting:component>  <logger message="#[flowVars.dataTimeZone]" level="INFO" doc:name="Logger"/>  </flow>  </mule> Xml completo