Skip to content

Instantly share code, notes, and snippets.

@alopresto
Created February 2, 2018 15:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alopresto/aec7eadd2ed8affd7be8e4056699e5f4 to your computer and use it in GitHub Desktop.
Save alopresto/aec7eadd2ed8affd7be8e4056699e5f4 to your computer and use it in GitHub Desktop.
Simple flow to publish and consume JMS messages from an ActiveMQ queue.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flowController encoding-version="1.3">
<maxTimerDrivenThreadCount>10</maxTimerDrivenThreadCount>
<maxEventDrivenThreadCount>5</maxEventDrivenThreadCount>
<registries/>
<rootGroup>
<id>1f73b0f0-0161-1000-fe9c-2d7ad542217c</id>
<name>NiFi Flow</name>
<position x="0.0" y="0.0"/>
<comment/>
<processor>
<id>0161100d-70b0-1dc2-2087-55cd42af8bdc</id>
<name>PublishJMS</name>
<position x="63.0" y="153.0"/>
<styles/>
<comment/>
<class>org.apache.nifi.jms.processors.PublishJMS</class>
<bundle>
<group>org.apache.nifi</group>
<artifact>nifi-jms-processors-nar</artifact>
<version>1.6.0-SNAPSHOT</version>
</bundle>
<maxConcurrentTasks>10</maxConcurrentTasks>
<schedulingPeriod>0 sec</schedulingPeriod>
<penalizationPeriod>30 sec</penalizationPeriod>
<yieldPeriod>1 sec</yieldPeriod>
<bulletinLevel>WARN</bulletinLevel>
<lossTolerant>false</lossTolerant>
<scheduledState>STOPPED</scheduledState>
<schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
<executionNode>ALL</executionNode>
<runDurationNanos>0</runDurationNanos>
<property>
<name>Connection Factory Service</name>
<value>01611012-70b0-1dc2-6871-2444309ab1c7</value>
</property>
<property>
<name>Destination Name</name>
<value>test_queue</value>
</property>
<property>
<name>Destination Type</name>
<value>QUEUE</value>
</property>
<property>
<name>User Name</name>
</property>
<property>
<name>Password</name>
</property>
<property>
<name>Connection Client ID</name>
</property>
<property>
<name>Session Cache size</name>
<value>1</value>
</property>
</processor>
<processor>
<id>0161100f-70b0-1dc2-6b06-1f3c36c00976</id>
<name>LogAttribute</name>
<position x="484.0" y="151.0"/>
<styles/>
<comment/>
<class>org.apache.nifi.processors.standard.LogAttribute</class>
<bundle>
<group>org.apache.nifi</group>
<artifact>nifi-standard-nar</artifact>
<version>1.6.0-SNAPSHOT</version>
</bundle>
<maxConcurrentTasks>1</maxConcurrentTasks>
<schedulingPeriod>0 sec</schedulingPeriod>
<penalizationPeriod>30 sec</penalizationPeriod>
<yieldPeriod>1 sec</yieldPeriod>
<bulletinLevel>WARN</bulletinLevel>
<lossTolerant>false</lossTolerant>
<scheduledState>STOPPED</scheduledState>
<schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
<executionNode>ALL</executionNode>
<runDurationNanos>0</runDurationNanos>
<property>
<name>Log Level</name>
<value>info</value>
</property>
<property>
<name>Log Payload</name>
<value>true</value>
</property>
<property>
<name>Attributes to Log</name>
</property>
<property>
<name>attributes-to-log-regex</name>
<value>.*</value>
</property>
<property>
<name>Attributes to Ignore</name>
</property>
<property>
<name>attributes-to-ignore-regex</name>
</property>
<property>
<name>Log prefix</name>
</property>
<property>
<name>character-set</name>
<value>UTF-8</value>
</property>
<autoTerminatedRelationship>success</autoTerminatedRelationship>
</processor>
<processor>
<id>0161100e-70b0-1dc2-4386-03f7b1ba745a</id>
<name>ConsumeJMS</name>
<position x="491.0" y="-52.0"/>
<styles/>
<comment/>
<class>org.apache.nifi.jms.processors.ConsumeJMS</class>
<bundle>
<group>org.apache.nifi</group>
<artifact>nifi-jms-processors-nar</artifact>
<version>1.6.0-SNAPSHOT</version>
</bundle>
<maxConcurrentTasks>10</maxConcurrentTasks>
<schedulingPeriod>0 sec</schedulingPeriod>
<penalizationPeriod>30 sec</penalizationPeriod>
<yieldPeriod>1 sec</yieldPeriod>
<bulletinLevel>WARN</bulletinLevel>
<lossTolerant>false</lossTolerant>
<scheduledState>STOPPED</scheduledState>
<schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
<executionNode>ALL</executionNode>
<runDurationNanos>0</runDurationNanos>
<property>
<name>Connection Factory Service</name>
<value>01611012-70b0-1dc2-6871-2444309ab1c7</value>
</property>
<property>
<name>Destination Name</name>
<value>test_queue</value>
</property>
<property>
<name>Destination Type</name>
<value>QUEUE</value>
</property>
<property>
<name>User Name</name>
</property>
<property>
<name>Password</name>
</property>
<property>
<name>Connection Client ID</name>
</property>
<property>
<name>Session Cache size</name>
<value>1</value>
</property>
<property>
<name>Acknowledgement Mode</name>
<value>2</value>
</property>
<property>
<name>Durable subscription</name>
<value>false</value>
</property>
<property>
<name>Shared subscription</name>
<value>false</value>
</property>
<property>
<name>Subscription Name</name>
</property>
</processor>
<processor>
<id>0161100b-70b0-1dc2-ad30-21fef33d5e3a</id>
<name>GenerateFlowFile</name>
<position x="62.0" y="-51.0"/>
<styles/>
<comment/>
<class>org.apache.nifi.processors.standard.GenerateFlowFile</class>
<bundle>
<group>org.apache.nifi</group>
<artifact>nifi-standard-nar</artifact>
<version>1.6.0-SNAPSHOT</version>
</bundle>
<maxConcurrentTasks>10</maxConcurrentTasks>
<schedulingPeriod>0 sec</schedulingPeriod>
<penalizationPeriod>30 sec</penalizationPeriod>
<yieldPeriod>1 sec</yieldPeriod>
<bulletinLevel>WARN</bulletinLevel>
<lossTolerant>false</lossTolerant>
<scheduledState>STOPPED</scheduledState>
<schedulingStrategy>TIMER_DRIVEN</schedulingStrategy>
<executionNode>ALL</executionNode>
<runDurationNanos>0</runDurationNanos>
<property>
<name>File Size</name>
<value>0B</value>
</property>
<property>
<name>Batch Size</name>
<value>1</value>
</property>
<property>
<name>Data Format</name>
<value>Text</value>
</property>
<property>
<name>Unique FlowFiles</name>
<value>false</value>
</property>
<property>
<name>generate-ff-custom-text</name>
<value>This is a message generated at ${now():format('yyyy/MM/dd HH:mm:ss.SSS Z')}. </value>
</property>
<property>
<name>character-set</name>
<value>UTF-8</value>
</property>
</processor>
<connection>
<id>01611011-70b0-1dc2-3cc9-d402f1153954</id>
<name/>
<bendPoints/>
<labelIndex>1</labelIndex>
<zIndex>0</zIndex>
<sourceId>0161100b-70b0-1dc2-ad30-21fef33d5e3a</sourceId>
<sourceGroupId>1f73b0f0-0161-1000-fe9c-2d7ad542217c</sourceGroupId>
<sourceType>PROCESSOR</sourceType>
<destinationId>0161100d-70b0-1dc2-2087-55cd42af8bdc</destinationId>
<destinationGroupId>1f73b0f0-0161-1000-fe9c-2d7ad542217c</destinationGroupId>
<destinationType>PROCESSOR</destinationType>
<relationship>success</relationship>
<maxWorkQueueSize>10000</maxWorkQueueSize>
<maxWorkQueueDataSize>1 GB</maxWorkQueueDataSize>
<flowFileExpiration>0 sec</flowFileExpiration>
</connection>
<connection>
<id>01611010-70b0-1dc2-ebdf-604c28e37fc5</id>
<name/>
<bendPoints/>
<labelIndex>1</labelIndex>
<zIndex>0</zIndex>
<sourceId>0161100e-70b0-1dc2-4386-03f7b1ba745a</sourceId>
<sourceGroupId>1f73b0f0-0161-1000-fe9c-2d7ad542217c</sourceGroupId>
<sourceType>PROCESSOR</sourceType>
<destinationId>0161100f-70b0-1dc2-6b06-1f3c36c00976</destinationId>
<destinationGroupId>1f73b0f0-0161-1000-fe9c-2d7ad542217c</destinationGroupId>
<destinationType>PROCESSOR</destinationType>
<relationship>success</relationship>
<maxWorkQueueSize>10000</maxWorkQueueSize>
<maxWorkQueueDataSize>1 GB</maxWorkQueueDataSize>
<flowFileExpiration>0 sec</flowFileExpiration>
</connection>
<connection>
<id>01611014-70b0-1dc2-45a0-68c6fb6ed3ae</id>
<name/>
<bendPoints>
<bendPoint x="246.0" y="474.0"/>
<bendPoint x="630.0" y="474.0"/>
</bendPoints>
<labelIndex>0</labelIndex>
<zIndex>0</zIndex>
<sourceId>0161100d-70b0-1dc2-2087-55cd42af8bdc</sourceId>
<sourceGroupId>1f73b0f0-0161-1000-fe9c-2d7ad542217c</sourceGroupId>
<sourceType>PROCESSOR</sourceType>
<destinationId>0161100f-70b0-1dc2-6b06-1f3c36c00976</destinationId>
<destinationGroupId>1f73b0f0-0161-1000-fe9c-2d7ad542217c</destinationGroupId>
<destinationType>PROCESSOR</destinationType>
<relationship>failure</relationship>
<maxWorkQueueSize>10000</maxWorkQueueSize>
<maxWorkQueueDataSize>1 GB</maxWorkQueueDataSize>
<flowFileExpiration>0 sec</flowFileExpiration>
</connection>
<connection>
<id>01611013-70b0-1dc2-b6fe-cc721ea9bd8a</id>
<name/>
<bendPoints>
<bendPoint x="229.0" y="556.0"/>
<bendPoint x="653.0" y="559.0"/>
</bendPoints>
<labelIndex>0</labelIndex>
<zIndex>0</zIndex>
<sourceId>0161100d-70b0-1dc2-2087-55cd42af8bdc</sourceId>
<sourceGroupId>1f73b0f0-0161-1000-fe9c-2d7ad542217c</sourceGroupId>
<sourceType>PROCESSOR</sourceType>
<destinationId>0161100f-70b0-1dc2-6b06-1f3c36c00976</destinationId>
<destinationGroupId>1f73b0f0-0161-1000-fe9c-2d7ad542217c</destinationGroupId>
<destinationType>PROCESSOR</destinationType>
<relationship>success</relationship>
<maxWorkQueueSize>10000</maxWorkQueueSize>
<maxWorkQueueDataSize>1 GB</maxWorkQueueDataSize>
<flowFileExpiration>0 sec</flowFileExpiration>
</connection>
<controllerService>
<id>01611012-70b0-1dc2-6871-2444309ab1c7</id>
<name>JMSConnectionFactoryProvider</name>
<comment/>
<class>org.apache.nifi.jms.cf.JMSConnectionFactoryProvider</class>
<bundle>
<group>org.apache.nifi</group>
<artifact>nifi-jms-processors-nar</artifact>
<version>1.6.0-SNAPSHOT</version>
</bundle>
<enabled>true</enabled>
<property>
<name>cf</name>
<value>org.apache.activemq.ActiveMQConnectionFactory</value>
</property>
<property>
<name>cflib</name>
<value>/Users/alopresto/Downloads/apache-activemq-5.15.0/lib</value>
</property>
<property>
<name>broker</name>
<value>tcp://localhost:32768</value>
</property>
<property>
<name>SSL Context Service</name>
</property>
</controllerService>
</rootGroup>
<controllerServices/>
<reportingTasks/>
</flowController>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment