Skip to content

Instantly share code, notes, and snippets.

@ricston-git
ricston-git / categorized_functions_exposed_by_library.dwl
Last active August 28, 2018 12:24
Gist for "Use cases for the readUrl function in DataWeave" blog-post
---
{
functionsOnObjects: {
getUniqueKeys: getUniqueKeys,
getKeys: getKeys
},
functionsOnStrings: {
substring: substringFunc
},
functionsOnArrays: {
public class QuerySingleFileProcessor implements Callable, Startable {
private SftpConnector sftpConnector;
private ImmutableEndpoint immutableEndpoint;
private SftpReceiverRequesterUtil util;
@Inject
private MuleContext muleContext;
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException
{
muleContext = getMuleContext(jobExecutionContext);
if (muleContext.isPrimaryPollingInstance() ||
TRUE.equals(jobExecutionContext.getJobDetail().getJobDataMap().get(PROPERTY_JOB_DYNAMIC)))
{
doExecute(jobExecutionContext);
}
}
@ricston-git
ricston-git / rabbitmq-manualack.xml
Created July 18, 2017 08:03
Mule flow for connecting to RabbitMQ using Manual Acknowledgements
<amqp:endpoint exchangeName="main-exchange" queueName="queue1" exchangeDurable="true" name="AMQP_0_9_queue1" responseTimeout="10000" doc:name="AMQP-0-9" routingKey="rk-q1" exchangeType="direct" exchange-pattern="request-response"/>
<amqp:endpoint exchangeName="main-exchange" queueName="queue2" name="AMQP_0_9_queue2" responseTimeout="10000" doc:name="AMQP-0-9" exchangeDurable="true" routingKey="rk-q2" exchangeType="direct"/>
<amqp:connector name="AMQP_0_9_Connector" validateConnections="true" username="administrator" password="password" doc:name="AMQP-0-9 Connector" ackMode="MANUAL"/>
<flow name="rabbitmq-receiveFromServer-queuetestFlow">
<amqp:inbound-endpoint responseTimeout="10000" exchange-pattern="request-response" doc:name="AMQP-MSG-FROM-QUEUE1" ref="AMQP_0_9_queue1" connector-ref="AMQP_0_9_Connector"/>
<byte-array-to-object-transformer returnClass="java.lang.String" doc:name="Byte Array to Object"/>
<logger message="Message from Queue1: #[payload]" level="INFO" doc:name="Logger: Incoming
@ricston-git
ricston-git / rabbitmq-autoack.xml
Created July 18, 2017 07:59
Mule flow for connecting to RabbitMQ using the default Auto Acknowledgements.
<amqp:endpoint exchangeName="main-exchange" queueName="queue1" exchangeDurable="true" name="AMQP_0_9_queue1" responseTimeout="10000" doc:name="AMQP-0-9" routingKey="rk-q1" exchangeType="direct" exchange-pattern="request-response"/>
<amqp:endpoint exchangeName="main-exchange" queueName="queue2" name="AMQP_0_9_queue2" responseTimeout="10000" doc:name="AMQP-0-9" exchangeDurable="true" routingKey="rk-q2" exchangeType="direct"/>
<amqp:connector name="AMQP_0_9_Connector" validateConnections="true" username="administrator" password="password" doc:name="AMQP-0-9 Connector"/>
<flow name="rabbitmq-receiveFromServer-queuetestFlow">
<amqp:inbound-endpoint responseTimeout="10000" exchange-pattern="request-response" doc:name="AMQP-MSG-FROM-QUEUE1" ref="AMQP_0_9_queue1" connector-ref="AMQP_0_9_Connector"/>
<byte-array-to-object-transformer returnClass="java.lang.String" doc:name="Byte Array to Object"/>
<logger message="Message from Queue1: #[payload]" level="INFO" doc:name="Logger: Incoming from RabbitMQ"/>
<flow name="request-reply-asyncFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP" />
<set-payload value="#[{'1','2','3','1','2','3','1','2','3'}]" doc:name="Set Payload" />
<logger message="#[payload]" level="INFO" doc:name="Logger" />
<request-reply doc:name="Request-Reply">
<vm:outbound-endpoint exchange-pattern="one-way" path="vmRequest" doc:name="VM">
<collection-splitter />
</vm:outbound-endpoint>
<vm:inbound-endpoint exchange-pattern="one-way" path="vmReply" doc:name="VM">
<collection-aggregator />
<request-reply doc:name="Request-Reply">
<vm:outbound-endpoint exchange-pattern="one-way" path="vmRequest" doc:name="VM">
<collection-splitter />
</vm:outbound-endpoint>
<vm:inbound-endpoint exchange-pattern="one-way" path="vmReply" doc:name="VM">
<collection-aggregator />
</vm:inbound-endpoint>
</request-reply>
<flow name="request-reply-asyncFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<set-payload value="#[{'1','2','3','1','2','3','1','2','3'}]" doc:name="Set Payload"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
<collection-splitter doc:name="Collection Splitter"/>
<request-reply doc:name="Request-Reply">
<vm:outbound-endpoint exchange-pattern="one-way" path="vmRequest" doc:name="VM"/>
<vm:inbound-endpoint exchange-pattern="one-way" path="vmReply" doc:name="VM"/>
</request-reply>
<collection-aggregator failOnTimeout="true" doc:name="Collection Aggregator"/>
@ricston-git
ricston-git / Gruntfile.js
Created May 19, 2016 15:46
Gist for "Java Build Tools, JavaScript Package Managers and Task Runners (Part 3)" blog-post.
/* File: Gruntfile.js */
//wrapper function
module.exports = function(grunt) {
//Project and task configuration.
grunt.initConfig({
//this task is responsible for deleting all files and sub-folders under the folder "/prod".
clean: {
//here we use a globbing pattern to match everything inside the `prod` folder
@ricston-git
ricston-git / gulpfile.js
Created May 18, 2016 13:26
Gist for "Java Build Tools, JavaScript Package Managers and Task Runners (Part 3)" blog-post.
/* File: gulpfile.js */
//import our gulp packages
var gulp = require('gulp'),
gutil = require('gulp-util')
minify = require('gulp-minify')
del = require('del');
//create a 'default' task - to be executed when 'gulp' is run from terminal. The 'default' task depends on 'clean-prod' and 'minify-js' tasks; in that order.
gulp.task('default', ['minify-js']);