twitter semi-working
authorDavid Kaufmann <david.kaufmann@student.tuwien.ac.at>
Sat, 24 Nov 2018 05:39:57 +0000 (06:39 +0100)
committerDavid Kaufmann <david.kaufmann@student.tuwien.ac.at>
Sat, 24 Nov 2018 05:39:57 +0000 (06:39 +0100)
camunda-overlay/sentiment-analysis.bpmn

index 1bdd8d7bdb1d60d15445e5ec0c0854538e05ce5d..c9392d4f11df17c3ca788e62a94f9fd84f00803f 100644 (file)
@@ -5,8 +5,8 @@
   </bpmn:collaboration>
   <bpmn:process id="sentiment-analysis" name="Sentiment Analysis" isExecutable="true" camunda:versionTag="0.0.1">
     <bpmn:laneSet id="LaneSet_1u08y0e" />
-    <bpmn:sequenceFlow id="SequenceFlow_0jumhlh" sourceRef="IntermediateThrowEvent_0d8ns1p" targetRef="Task_1n6iu8h" />
-    <bpmn:sequenceFlow id="SequenceFlow_14nqu0e" sourceRef="Task_1n6iu8h" targetRef="Task_1e7059p" />
+    <bpmn:sequenceFlow id="SequenceFlow_0jumhlh" sourceRef="IntermediateThrowEvent_0d8ns1p" targetRef="service-report" />
+    <bpmn:sequenceFlow id="SequenceFlow_14nqu0e" sourceRef="service-report" targetRef="Task_1e7059p" />
     <bpmn:sequenceFlow id="SequenceFlow_0htopx7" sourceRef="SubProcess_1skl2rb" targetRef="IntermediateThrowEvent_0d8ns1p" />
     <bpmn:sequenceFlow id="SequenceFlow_11xavl5" sourceRef="StartEvent_1t6nxib" targetRef="SubProcess_1skl2rb" />
     <bpmn:sequenceFlow id="SequenceFlow_0tu3w40" sourceRef="IntermediateThrowEvent_1u3snd0" targetRef="EndEvent_0bmuv13" />
       <bpmn:incoming>SequenceFlow_14nqu0e</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0jebdb9</bpmn:outgoing>
     </bpmn:userTask>
-    <bpmn:startEvent id="StartEvent_1t6nxib" camunda:formKey="embedded:deployment:input-terms.html">
-      <bpmn:outgoing>SequenceFlow_11xavl5</bpmn:outgoing>
-    </bpmn:startEvent>
-    <bpmn:serviceTask id="Task_1n6iu8h" name="Report Service" camunda:expression="&#34;&#34;">
+    <bpmn:serviceTask id="service-report" name="Report Service" camunda:expression="&#34;&#34;">
       <bpmn:incoming>SequenceFlow_0jumhlh</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_14nqu0e</bpmn:outgoing>
     </bpmn:serviceTask>
       <bpmn:startEvent id="StartEvent_1nx6b6f">
         <bpmn:outgoing>SequenceFlow_0f6v4j4</bpmn:outgoing>
       </bpmn:startEvent>
-      <bpmn:serviceTask id="ServiceTask_1o2usc9" name="Twitter Service">
+      <bpmn:serviceTask id="service-twitter" name="Twitter Service">
         <bpmn:extensionElements>
           <camunda:connector>
             <camunda:inputOutput>
-              <camunda:inputParameter name="url">http://twitter:8084/search/tweets.json</camunda:inputParameter>
+              <camunda:inputParameter name="url">
+                <camunda:script scriptFormat="Javascript">var term = execution.getVariable("term");
+'http://twitter:8084/search/tweets.json?q='+term.term;</camunda:script>
+              </camunda:inputParameter>
               <camunda:inputParameter name="method">GET</camunda:inputParameter>
               <camunda:inputParameter name="headers">
                 <camunda:map>
                   <camunda:entry key="Accept">application/json</camunda:entry>
                 </camunda:map>
               </camunda:inputParameter>
-              <camunda:inputParameter name="payload">
-                <camunda:script scriptFormat="Javascript">"q=${term}"</camunda:script>
-              </camunda:inputParameter>
               <camunda:outputParameter name="tweets">
                 <camunda:script scriptFormat="Javascript">var response = connector.getVariable("response");
 S(response);</camunda:script>
@@ -68,36 +65,45 @@ S(response);</camunda:script>
             <camunda:connectorId>http-connector</camunda:connectorId>
           </camunda:connector>
         </bpmn:extensionElements>
-        <bpmn:incoming>SequenceFlow_08cvkud</bpmn:incoming>
+        <bpmn:incoming>SequenceFlow_0f6v4j4</bpmn:incoming>
         <bpmn:outgoing>SequenceFlow_0g6bfz6</bpmn:outgoing>
       </bpmn:serviceTask>
-      <bpmn:sequenceFlow id="SequenceFlow_0f6v4j4" sourceRef="StartEvent_1nx6b6f" targetRef="IntermediateCatchEvent_18phl41" />
-      <bpmn:sequenceFlow id="SequenceFlow_0g6bfz6" sourceRef="ServiceTask_1o2usc9" targetRef="IntermediateCatchEvent_0rrmr11" />
+      <bpmn:sequenceFlow id="SequenceFlow_0f6v4j4" sourceRef="StartEvent_1nx6b6f" targetRef="service-twitter" />
+      <bpmn:sequenceFlow id="SequenceFlow_0g6bfz6" sourceRef="service-twitter" targetRef="service-analysis" />
       <bpmn:endEvent id="EndEvent_1b95153">
         <bpmn:incoming>SequenceFlow_1bz7zx2</bpmn:incoming>
       </bpmn:endEvent>
-      <bpmn:sequenceFlow id="SequenceFlow_1bz7zx2" sourceRef="Task_12o1uz7" targetRef="EndEvent_1b95153" />
-      <bpmn:serviceTask id="Task_12o1uz7" name="Analysis Service" camunda:expression="&#34;&#34;">
-        <bpmn:incoming>SequenceFlow_0dcynq6</bpmn:incoming>
+      <bpmn:sequenceFlow id="SequenceFlow_1bz7zx2" sourceRef="service-analysis" targetRef="EndEvent_1b95153" />
+      <bpmn:serviceTask id="service-analysis" name="Analysis Service">
+        <bpmn:extensionElements>
+          <camunda:connector>
+            <camunda:inputOutput>
+              <camunda:inputParameter name="url">http://analysis:8081/</camunda:inputParameter>
+              <camunda:inputParameter name="method">POST</camunda:inputParameter>
+              <camunda:inputParameter name="headers">
+                <camunda:map>
+                  <camunda:entry key="Accept">application/json</camunda:entry>
+                </camunda:map>
+              </camunda:inputParameter>
+              <camunda:inputParameter name="payload">
+                <camunda:script scriptFormat="Javascript">var tweets = execution.getVariable("tweets");
+'{"q": "'+tweets+'"}';</camunda:script>
+              </camunda:inputParameter>
+              <camunda:outputParameter name="analysis_results">
+                <camunda:script scriptFormat="Javascript">var response = connector.getVariable("response");
+S(response);</camunda:script>
+              </camunda:outputParameter>
+            </camunda:inputOutput>
+            <camunda:connectorId>http-connector</camunda:connectorId>
+          </camunda:connector>
+        </bpmn:extensionElements>
+        <bpmn:incoming>SequenceFlow_0g6bfz6</bpmn:incoming>
         <bpmn:outgoing>SequenceFlow_1bz7zx2</bpmn:outgoing>
       </bpmn:serviceTask>
-      <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0rrmr11">
-        <bpmn:incoming>SequenceFlow_0g6bfz6</bpmn:incoming>
-        <bpmn:outgoing>SequenceFlow_0dcynq6</bpmn:outgoing>
-        <bpmn:timerEventDefinition id="TimerEventDefinition_0mlb6ia">
-          <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT5S</bpmn:timeDuration>
-        </bpmn:timerEventDefinition>
-      </bpmn:intermediateCatchEvent>
-      <bpmn:sequenceFlow id="SequenceFlow_0dcynq6" sourceRef="IntermediateCatchEvent_0rrmr11" targetRef="Task_12o1uz7" />
-      <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_18phl41">
-        <bpmn:incoming>SequenceFlow_0f6v4j4</bpmn:incoming>
-        <bpmn:outgoing>SequenceFlow_08cvkud</bpmn:outgoing>
-        <bpmn:timerEventDefinition id="TimerEventDefinition_0n31tww">
-          <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT5S</bpmn:timeDuration>
-        </bpmn:timerEventDefinition>
-      </bpmn:intermediateCatchEvent>
-      <bpmn:sequenceFlow id="SequenceFlow_08cvkud" sourceRef="IntermediateCatchEvent_18phl41" targetRef="ServiceTask_1o2usc9" />
     </bpmn:subProcess>
+    <bpmn:startEvent id="StartEvent_1t6nxib" camunda:formKey="embedded:deployment:input-terms.html">
+      <bpmn:outgoing>SequenceFlow_11xavl5</bpmn:outgoing>
+    </bpmn:startEvent>
   </bpmn:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1x8eoy3">
@@ -108,7 +114,7 @@ S(response);</camunda:script>
         <dc:Bounds x="1306" y="231" width="36" height="36" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="StartEvent_1t6nxib_di" bpmnElement="StartEvent_1t6nxib">
-        <dc:Bounds x="50" y="231" width="36" height="36" />
+        <dc:Bounds x="53" y="71" width="36" height="36" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0jebdb9_di" bpmnElement="SequenceFlow_0jebdb9">
         <di:waypoint x="1199" y="249" />
@@ -128,9 +134,9 @@ S(response);</camunda:script>
         <dc:Bounds x="1233" y="231" width="36" height="36" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_11xavl5_di" bpmnElement="SequenceFlow_11xavl5">
-        <di:waypoint x="86" y="249" />
-        <di:waypoint x="163" y="249" />
-        <di:waypoint x="163" y="248" />
+        <di:waypoint x="89" y="89" />
+        <di:waypoint x="164" y="89" />
+        <di:waypoint x="164" y="248" />
         <di:waypoint x="239" y="248" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="SubProcess_1skl2rb_di" bpmnElement="SubProcess_1skl2rb" isExpanded="true">
@@ -139,16 +145,16 @@ S(response);</camunda:script>
       <bpmndi:BPMNShape id="StartEvent_1nx6b6f_di" bpmnElement="StartEvent_1nx6b6f">
         <dc:Bounds x="260" y="228" width="36" height="36" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="ServiceTask_1o2usc9_di" bpmnElement="ServiceTask_1o2usc9">
+      <bpmndi:BPMNShape id="ServiceTask_1o2usc9_di" bpmnElement="service-twitter">
         <dc:Bounds x="388" y="206" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0f6v4j4_di" bpmnElement="SequenceFlow_0f6v4j4">
         <di:waypoint x="296" y="246" />
-        <di:waypoint x="316" y="246" />
+        <di:waypoint x="388" y="246" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0g6bfz6_di" bpmnElement="SequenceFlow_0g6bfz6">
         <di:waypoint x="488" y="246" />
-        <di:waypoint x="510" y="246" />
+        <di:waypoint x="579" y="246" />
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="EndEvent_1b95153_di" bpmnElement="EndEvent_1b95153">
         <dc:Bounds x="726" y="228" width="36" height="36" />
@@ -167,30 +173,16 @@ S(response);</camunda:script>
         <di:waypoint x="1043" y="249" />
         <di:waypoint x="1099" y="249" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ServiceTask_1gaqtzh_di" bpmnElement="Task_1n6iu8h">
+      <bpmndi:BPMNShape id="ServiceTask_1gaqtzh_di" bpmnElement="service-report">
         <dc:Bounds x="943" y="209" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0jumhlh_di" bpmnElement="SequenceFlow_0jumhlh">
         <di:waypoint x="903" y="249" />
         <di:waypoint x="943" y="249" />
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ServiceTask_1ledx9h_di" bpmnElement="Task_12o1uz7">
+      <bpmndi:BPMNShape id="ServiceTask_01bq7a6_di" bpmnElement="service-analysis">
         <dc:Bounds x="579" y="206" width="100" height="80" />
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="IntermediateCatchEvent_0rrmr11_di" bpmnElement="IntermediateCatchEvent_0rrmr11">
-        <dc:Bounds x="510" y="228" width="36" height="36" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0dcynq6_di" bpmnElement="SequenceFlow_0dcynq6">
-        <di:waypoint x="546" y="246" />
-        <di:waypoint x="579" y="246" />
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="IntermediateCatchEvent_18phl41_di" bpmnElement="IntermediateCatchEvent_18phl41">
-        <dc:Bounds x="316" y="228" width="36" height="36" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_08cvkud_di" bpmnElement="SequenceFlow_08cvkud">
-        <di:waypoint x="352" y="246" />
-        <di:waypoint x="388" y="246" />
-      </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn:definitions>