Clone wiki

flux-plugins / Home

Flux plugins

Flux plugins (actions or triggers as most Flux users are familiar with) can be used to integrate any custom applications seamlessly within a Flux workflow. These plugins are available in your Flux workflow using the Web-based designer or the Desktop designer and monitored from the Operations Console.

Requirements

  • Flux 7.10 or later. You can download it from here and check out our portal for installation procedure.
  • Java 1.6.

Maven Users

Install flux.jar to your local maven repo. A simple way to do this from your flux installation is:

mvn install:install-file -DgroupId=flux -DartifactId=flux -Dversion=7.11.3 -Dpackaging=jar -Dfile=flux.jar

And now, you can include Flux and all other plugin dependencies in your Maven POM.

<dependency>
  <groupId>flux</groupId>
  <artifactId>flux</artifactId>
  <version>7.11.3</version>
</dependency>
<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>git-trigger</artifactId>
  <version>1.0.4</version>
</dependency>
<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>jms-trigger</artifactId>
  <version>1.0.4</version>
</dependency>
<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>rabbitmq-action</artifactId>
  <version>1.0.4</version>
</dependency>
<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>rabbitmq-trigger</artifactId>
  <version>1.0.4</version>
</dependency>
<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>twitter-action</artifactId>
  <version>1.0.4</version>
</dependency>
<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>mercurial-trigger</artifactId>
  <version>1.0.4</version>
</dependency>
<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>webservice-trigger</artifactId>
  <version>1.0.4</version>
</dependency>
<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>unzipfile-action</artifactId>
  <version>1.0.4</version>
</dependency>
<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>untarfile-action</artifactId>
  <version>1.0.4</version>
</dependency>
<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>http-filetransfer-action</artifactId>
  <version>1.0.4</version>
</dependency>
<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>scp-action</artifactId>
  <version>1.0.4</version>
</dependency>

These artifacts are synced to Maven central.

Maven Snapshots

For latest Maven snapshots,

<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>git-trigger</artifactId>
  <version>1.0.5-SNAPSHOT</version>
</dependency>
<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>jms-trigger</artifactId>
  <version>1.0.5-SNAPSHOT</version>
</dependency>
<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>rabbitmq-action</artifactId>
  <version>1.0.5-SNAPSHOT</version>
</dependency>
<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>rabbitmq-trigger</artifactId>
  <version>1.0.5-SNAPSHOT</version>
</dependency>
<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>twitter-action</artifactId>
  <version>1.0.5-SNAPSHOT</version>
</dependency>
<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>mercurial-trigger</artifactId>
  <version>1.0.5-SNAPSHOT</version>
</dependency>
<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>webservice-trigger</artifactId>
  <version>1.0.5-SNAPSHOT</version>
</dependency>
<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>unzipfile-action</artifactId>
  <version>1.0.5-SNAPSHOT</version>
</dependency>
<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>untarfile-action</artifactId>
  <version>1.0.5-SNAPSHOT</version>
</dependency>
<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>http-filetransfer-action</artifactId>
  <version>1.0.5-SNAPSHOT</version>
</dependency>
<dependency>
  <groupId>com.fluxcorp.plugins</groupId>
  <artifactId>scp-action</artifactId>
  <version>1.0.5-SNAPSHOT</version>
</dependency>

And add this maven snapshots repository in your POM.

<repository>
  <id>sonatype-nexus-snapshots</id>
  <name>sonatype-nexus-snapshots</name>
  <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>

Non-maven Users

  • Download the plugin distribution from here which includes all the dependencies in lib directory.

RabbitMQ Plugin Dependencies

The RabbitMQ dependencies include the following:

  • RabbitMQ Java AMQP 2.8.1 client
  • Commons IO 1.2
  • Commons CLI 1.1

rabbitmq_dependencies.png

Twitter Plugin Dependencies

The Twitter dependencies include the following:

  • Scribe 1.3.1 OAuth library
  • Commons Codec 1.4
  • jsoup 1.6.3 Java HTML Parser

twitter_dependencies.png

You could drop these dependencies and plugin jars in your $FLUX_HOME/lib directory if you are using a standalone use or make them available in your engine classpath for embedded use.

Quick Start Guide

RabbitMQ Action plugin

rabbitmq_action.png

Publishing an AMQP message to a RabbitMQ channel would look something like this using Java APIs:

FlowChart flowChart = helper.makeFlowChart("RabbitMQ Action Example");
RabbitMQActionFactory customActionFactory = (RabbitMQActionFactory) flowChart.makeFactory("RabbitMQActionFactory");
RabbitMQAction rabbitMQAction = customActionFactory.makeRabbitMQAction("Publish AMQP Message");
rabbitMQAction.setHost("localhost");
rabbitMQAction.setUsername("guest");
rabbitMQAction.setPassword("guest");
rabbitMQAction.setExchangeName("nasdaq.exchange");
rabbitMQAction.setExchangeType("direct");
rabbitMQAction.setQueueName("nasdaq.request");
rabbitMQAction.setQueueType("shared");
rabbitMQAction.setRoutingKey("nasdaq.request");
rabbitMQAction.setMessage("BUY GOOG 200");

//Schedule this job
String name = engine.put(flowChart);

RabbitMQ Trigger plugin

rabbitmq_trigger.png

Consuming a message using RabbitMQTrigger which monitors for messages in the RabbitMQ queue would look something like this using Java APIs:

FlowChart flowChart = helper.makeFlowChart("RabbitMQ Trigger Example");
RabbitMQTriggerFactory customTriggerFactory = (RabbitMQTriggerFactory) flowChart.makeFactory("RabbitMQTriggerFactory");
RabbitMQTrigger rabbitMQTrigger = customTriggerFactory.makeRabbitMQTrigger("Consume AMQP Message");
rabbitMQTrigger.setHost("localhost");
rabbitMQTrigger.setUsername("guest");
rabbitMQTrigger.setPassword("guest");
rabbitMQTrigger.setQueueName("nasdaq.request");

JavaAction messageProcessor = flowChart.makeJavaAction("Message Processor");
messageProcessor.setListener(MessageProcessor.class);

rabbitMQTrigger.addFlow(messageProcessor);

//loop back required for polling
messageProcessor.addFlow(rabbitMQTrigger);

//Schedule this job
String name = engine.put(flowChart);

Twitter plugin

twitter_action.png

Twitter plugin allows client to interface with Twitter programmatically. You have to register your application with Twitter to obtain consumer key and consumer secret, which is required for accessing any OAuth protected resources.

For example, retrieving twitter mentions would look something like this using Java APIs:

FlowChart flowChart = helper.makeFlowChart("Twitter Action Example");
TwitterActionFactory customActionFactory = (TwitterActionFactory) flowChart.makeFactory("TwitterActionFactory");
TwitterAction twitterMentions = customActionFactory.makeTwitterAction("Twitter Action");
twitterMentions.setConsumerKey(CONSUMER_KEY);
twitterMentions.setConsumerSecret(CONSUMER_SECRET);
twitterMentions.setOAuthEnabled(true);
twitterMentions.setRequestMethod(RestActionType.GET);
twitterMentions.setResourceUrl("http://api.twitter.com/1/statuses/mentions.json");
twitterMentions.setUsername(TWITTER_USER);
twitterMentions.setPassword(TWITTER_PASS);

//Schedule this job
engine.put(flowChart);

twitter_action_dm.png

For example, sending a direct message would look something like this using Java APIs:

TwitterAction directMessage = customActionFactory.makeTwitterAction("Twitter DM");
directMessage.setConsumerKey(CONSUMER_KEY);
directMessage.setConsumerSecret(CONSUMER_SECRET);
directMessage.setOAuthEnabled(true);
directMessage.setRequestMethod(RestActionType.POST);
directMessage.setResourceUrl("http://api.twitter.com/1/direct_messages/new.xml");
directMessage.setUsername(TWITTER_USER);

//add the required parameters
Properties properties = new Properties();
properties.put("screen_name", "fluxarul");
properties.put("user_id", "97133917");
properties.put("text", "Hello from Flux Twitter Action!");

directMessage.setParameters(properties);
directMessage.setPassword(TWITTER_PASS);

//Schedule this job
engine.put(flowChart);

More complete examples are found in the test directory of the plugins.

You can access the javadocs for all these plugins here and the maven site documentation.

Feel free to shout if you have any feedback or log an issue for bugs/improvements.

Updated