Commit 1796030a by amir

finished testing and designing zmqrestservice, hopefully

parent 844ca258
......@@ -37,3 +37,7 @@
2 activate method
3 add for metrics,stats etc'
4 Mitfanen :sleeping:
### ZMQRestService
![alt text](ZMQRestService.png)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd">
<!--Created by yEd 3.17-->
<key attr.name="Description" attr.type="string" for="graph" id="d0"/>
<key for="port" id="d1" yfiles.type="portgraphics"/>
<key for="port" id="d2" yfiles.type="portgeometry"/>
<key for="port" id="d3" yfiles.type="portuserdata"/>
<key attr.name="url" attr.type="string" for="node" id="d4"/>
<key attr.name="description" attr.type="string" for="node" id="d5"/>
<key for="node" id="d6" yfiles.type="nodegraphics"/>
<key for="graphml" id="d7" yfiles.type="resources"/>
<key attr.name="url" attr.type="string" for="edge" id="d8"/>
<key attr.name="description" attr.type="string" for="edge" id="d9"/>
<key for="edge" id="d10" yfiles.type="edgegraphics"/>
<graph edgedefault="directed" id="G">
<data key="d0"/>
<node id="n0" yfiles.foldertype="group">
<data key="d4"/>
<data key="d6">
<y:ProxyAutoBoundsNode>
<y:Realizers active="0">
<y:GroupNode>
<y:Geometry height="188.921875" width="252.0" x="145.0" y="-315.2942708333334"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="252.0" x="0.0" y="0.0">Server Reply</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
</y:GroupNode>
<y:GroupNode>
<y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="65.201171875" x="-7.6005859375" y="0.0">Folder 2</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="true" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="5" bottomF="5.0" left="5" leftF="5.0" right="5" rightF="5.0" top="5" topF="5.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
</y:GroupNode>
</y:Realizers>
</y:ProxyAutoBoundsNode>
</data>
<graph edgedefault="directed" id="n0:">
<node id="n0::n0">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="160.0" y="-225.60286458333343"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PULL<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
<node id="n0::n1" yfiles.foldertype="group">
<data key="d4"/>
<data key="d6">
<y:ProxyAutoBoundsNode>
<y:Realizers active="0">
<y:GroupNode>
<y:Geometry height="137.4609375" width="149.0" x="233.0" y="-278.8333333333334"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="149.0" x="0.0" y="0.0">ConnectionsMap</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="6" rightF="6.0" top="0" topF="0.0"/>
</y:GroupNode>
<y:GroupNode>
<y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="65.201171875" x="-7.6005859375" y="0.0">Folder 1</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="true" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="5" bottomF="5.0" left="5" leftF="5.0" right="5" rightF="5.0" top="5" topF="5.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
</y:GroupNode>
</y:Realizers>
</y:ProxyAutoBoundsNode>
</data>
<graph edgedefault="directed" id="n0::n1:">
<node id="n0::n1::n0">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="248.0" y="-242.37239583333343"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
<node id="n0::n1::n1">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="273.0" y="-217.37239583333343"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
<node id="n0::n1::n2">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="298.0" y="-192.37239583333343"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
</graph>
</node>
</graph>
</node>
<node id="n1" yfiles.foldertype="group">
<data key="d4"/>
<data key="d6">
<y:ProxyAutoBoundsNode>
<y:Realizers active="0">
<y:GroupNode>
<y:Geometry height="87.4609375" width="177.0" x="-324.5" y="-261.3528645833334"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="177.0" x="0.0" y="0.0">Server Receive</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
</y:GroupNode>
<y:GroupNode>
<y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="65.201171875" x="-7.6005859375" y="0.0">Folder 3</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="true" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="5" bottomF="5.0" left="5" leftF="5.0" right="5" rightF="5.0" top="5" topF="5.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
</y:GroupNode>
</y:Realizers>
</y:ProxyAutoBoundsNode>
</data>
<graph edgedefault="directed" id="n1:">
<node id="n1::n0">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="-309.5" y="-224.89192708333343"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PULL<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
<node id="n1::n1">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="-225.5" y="-224.89192708333343"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
</graph>
</node>
<node id="n2" yfiles.foldertype="group">
<data key="d4"/>
<data key="d6">
<y:ProxyAutoBoundsNode>
<y:Realizers active="0">
<y:GroupNode>
<y:Geometry height="88.69140625" width="195.47124394504883" x="-111.47124394504883" y="-164.60286458333343"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="195.47124394504883" x="0.0" y="0.0">ServerWorker</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="13" leftF="13.19248789009768" right="0" rightF="0.0" top="1" topF="1.23046875"/>
</y:GroupNode>
<y:GroupNode>
<y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="65.201171875" x="-7.6005859375" y="0.0">Folder 4</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="true" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="5" bottomF="5.0" left="5" leftF="5.0" right="5" rightF="5.0" top="5" topF="5.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
</y:GroupNode>
</y:Realizers>
</y:ProxyAutoBoundsNode>
</data>
<graph edgedefault="directed" id="n2:">
<node id="n2::n0">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="6.0" y="-126.91145833333343"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
<node id="n2::n1">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="-83.27875605495115" y="-126.91145833333343"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PULL<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
</graph>
</node>
<node id="n3" yfiles.foldertype="group">
<data key="d4"/>
<data key="d6">
<y:ProxyAutoBoundsNode>
<y:Realizers active="0">
<y:GroupNode>
<y:Geometry height="87.4609375" width="192.0" x="-324.5" y="79.77151041666554"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="192.0" x="0.0" y="0.0">Client Receive</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="11" rightF="11.0" top="0" topF="0.0"/>
</y:GroupNode>
<y:GroupNode>
<y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="65.201171875" x="-7.6005859375" y="0.0">Folder 4</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="true" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="5" bottomF="5.0" left="5" leftF="5.0" right="5" rightF="5.0" top="5" topF="5.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
</y:GroupNode>
</y:Realizers>
</y:ProxyAutoBoundsNode>
</data>
<graph edgedefault="directed" id="n3:">
<node id="n3::n0">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="-309.5" y="116.23244791666554"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PULL<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
<node id="n3::n1">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="-221.5" y="116.23244791666554"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
</graph>
</node>
<node id="n4" yfiles.foldertype="group">
<data key="d4"/>
<data key="d6">
<y:ProxyAutoBoundsNode>
<y:Realizers active="0">
<y:GroupNode>
<y:Geometry height="87.4609375" width="196.5" x="-112.5" y="-359.5247395833334"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="196.5" x="0.0" y="0.0">ServerWorker</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
</y:GroupNode>
<y:GroupNode>
<y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="65.201171875" x="-7.6005859375" y="0.0">Folder 6</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="true" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="5" bottomF="5.0" left="5" leftF="5.0" right="5" rightF="5.0" top="5" topF="5.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
</y:GroupNode>
</y:Realizers>
</y:ProxyAutoBoundsNode>
</data>
<graph edgedefault="directed" id="n4:">
<node id="n4::n0">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="-97.5" y="-323.0638020833334"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PULL<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
<node id="n4::n1">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="6.0" y="-323.0638020833334"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
</graph>
</node>
<node id="n5" yfiles.foldertype="group">
<data key="d4"/>
<data key="d6">
<y:ProxyAutoBoundsNode>
<y:Realizers active="0">
<y:GroupNode>
<y:Geometry height="87.4609375" width="196.5" x="-112.5" y="-262.0638020833334"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="196.5" x="0.0" y="0.0">ServerWorker</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
</y:GroupNode>
<y:GroupNode>
<y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="65.201171875" x="-7.6005859375" y="0.0">Folder 7</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="true" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="5" bottomF="5.0" left="5" leftF="5.0" right="5" rightF="5.0" top="5" topF="5.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
</y:GroupNode>
</y:Realizers>
</y:ProxyAutoBoundsNode>
</data>
<graph edgedefault="directed" id="n5:">
<node id="n5::n0">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="-97.5" y="-225.60286458333343"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PULL<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
<node id="n5::n1">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="6.0" y="-225.60286458333343"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
</graph>
</node>
<node id="n6" yfiles.foldertype="group">
<data key="d4"/>
<data key="d6">
<y:ProxyAutoBoundsNode>
<y:Realizers active="0">
<y:GroupNode>
<y:Geometry height="90.2578125" width="200.0" x="-99.27875605495115" y="76.97463541666554"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="200.0" x="0.0" y="0.0">ClientWorker</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="1" leftF="1.0" right="9" rightF="9.000000000000057" top="0" topF="0.0"/>
</y:GroupNode>
<y:GroupNode>
<y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="65.201171875" x="-7.6005859375" y="0.0">Folder 7</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="true" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="5" bottomF="5.0" left="5" leftF="5.0" right="5" rightF="5.0" top="5" topF="5.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
</y:GroupNode>
</y:Realizers>
</y:ProxyAutoBoundsNode>
</data>
<graph edgedefault="directed" id="n6:">
<node id="n6::n0">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="-83.27875605495115" y="116.23244791666554"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PULL<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
<node id="n6::n1">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="80.0" x="-8.278756054951202" y="116.23244791666554"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="36.59375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="71.4296875" x="4.28515625" y="-2.796875">Callback
Function<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
</graph>
</node>
<node id="n7" yfiles.foldertype="group">
<data key="d4"/>
<data key="d6">
<y:ProxyAutoBoundsNode>
<y:Realizers active="0">
<y:GroupNode>
<y:Geometry height="137.68718749999948" width="143.73000000000002" x="145.0" y="-111.37239583333343"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="143.73000000000002" x="0.0" y="0.0">Client Send</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
</y:GroupNode>
<y:GroupNode>
<y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="65.201171875" x="-7.6005859375" y="0.0">Folder 9</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="true" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="5" bottomF="5.0" left="5" leftF="5.0" right="5" rightF="5.0" top="5" topF="5.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
</y:GroupNode>
</y:Realizers>
</y:ProxyAutoBoundsNode>
</data>
<graph edgedefault="directed" id="n7:">
<node id="n7::n0">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="160.0" y="-74.91145833333343"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
<node id="n7::n1">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="185.365" y="-49.29833333333369"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
<node id="n7::n2">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="210.73000000000002" y="-24.685208333333946"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PUSH<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
</graph>
</node>
<node id="n8">
<data key="d5"/>
<data key="d6">
<y:GenericNode configuration="com.yworks.flowchart.annotation">
<y:Geometry height="55.0" width="99.0" x="318.73" y="-107.83536458333356"/>
<y:Fill hasColor="false" transparent="false"/>
<y:BorderStyle color="#000000" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="45.90625" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="95.646484375" x="1.6767578125" y="4.546875">Connection per
Thread
(Thread Local)<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:StyleProperties>
<y:Property class="java.lang.Byte" name="com.yworks.flowchart.style.orientation" value="0"/>
<y:Property class="java.lang.Byte" name="LAYER_STYLE_PROPERTY_KEY" value="1"/>
</y:StyleProperties>
</y:GenericNode>
</data>
</node>
<node id="n9" yfiles.foldertype="group">
<data key="d4"/>
<data key="d6">
<y:ProxyAutoBoundsNode>
<y:Realizers active="0">
<y:GroupNode>
<y:Geometry height="90.2578125" width="200.0" x="-99.27875605495115" y="187.32213541666556"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="200.0" x="0.0" y="0.0">ClientWorker</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="10" rightF="10.000000000000057" top="0" topF="0.0"/>
</y:GroupNode>
<y:GroupNode>
<y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="65.201171875" x="-7.6005859375" y="0.0">Folder 7</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="true" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="5" bottomF="5.0" left="5" leftF="5.0" right="5" rightF="5.0" top="5" topF="5.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
</y:GroupNode>
</y:Realizers>
</y:ProxyAutoBoundsNode>
</data>
<graph edgedefault="directed" id="n9:">
<node id="n9::n0">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="-84.27875605495115" y="226.57994791666556"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PULL<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
<node id="n9::n1">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="80.0" x="-9.278756054951202" y="226.57994791666556"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="36.59375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="71.4296875" x="4.28515625" y="-2.796875">Callback
Function<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
</graph>
</node>
<node id="n10" yfiles.foldertype="group">
<data key="d4"/>
<data key="d6">
<y:ProxyAutoBoundsNode>
<y:Realizers active="0">
<y:GroupNode>
<y:Geometry height="90.2578125" width="200.0" x="-99.27875605495115" y="-33.37286458333449"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="200.0" x="0.0" y="0.0">ClientWorker</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="10" rightF="10.000000000000057" top="0" topF="0.0"/>
</y:GroupNode>
<y:GroupNode>
<y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/>
<y:Fill color="#F5F5F5" transparent="false"/>
<y:BorderStyle color="#000000" type="dashed" width="1.0"/>
<y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="65.201171875" x="-7.6005859375" y="0.0">Folder 7</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:State closed="true" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
<y:Insets bottom="5" bottomF="5.0" left="5" leftF="5.0" right="5" rightF="5.0" top="5" topF="5.0"/>
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
</y:GroupNode>
</y:Realizers>
</y:ProxyAutoBoundsNode>
</data>
<graph edgedefault="directed" id="n10:">
<node id="n10::n0">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="58.0" x="-84.27875605495115" y="5.88494791666551"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="20.296875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="37.71484375" x="10.142578125" y="5.3515625">PULL<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
<node id="n10::n1">
<data key="d6">
<y:ShapeNode>
<y:Geometry height="31.0" width="80.0" x="-9.278756054951202" y="5.88494791666551"/>
<y:Fill color="#009688" transparent="false"/>
<y:BorderStyle hasColor="false" type="line" width="1.0"/>
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Monospaced" fontSize="14" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="36.59375" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#FFFFFF" verticalTextPosition="bottom" visible="true" width="71.4296875" x="4.28515625" y="-2.796875">Callback
Function<y:LabelModel>
<y:SmartNodeLabelModel distance="4.0"/>
</y:LabelModel>
<y:ModelParameter>
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
</y:ModelParameter>
</y:NodeLabel>
<y:Shape type="roundrectangle"/>
<y:DropShadow color="#C0C0C0" offsetX="5" offsetY="5"/>
</y:ShapeNode>
</data>
</node>
</graph>
</node>
<edge id="e0" source="n1::n1" target="n5::n0">
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="none" target="standard"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="e1" source="n5::n1" target="n0::n0">
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="none" target="standard"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n3::e0" source="n3::n0" target="n3::n1">
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="none" target="standard"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n1::e0" source="n1::n0" target="n1::n1">
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="none" target="standard"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n6::e0" source="n6::n0" target="n6::n1">
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="none" target="standard"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n9::e0" source="n9::n0" target="n9::n1">
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="none" target="standard"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="n10::e0" source="n10::n0" target="n10::n1">
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="none" target="standard"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="e2" source="n10" target="n9">
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
<y:Point x="-122.63499999999999" y="11.75604166666551"/>
<y:Point x="-122.63499999999999" y="232.45104166666556"/>
</y:Path>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="none" target="none"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="e3" source="n3" target="n6">
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="none" target="standard"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="e4" source="n4" target="n2">
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
<y:Point x="-137.635" y="-315.7942708333334"/>
<y:Point x="-137.635" y="-120.25716145833343"/>
</y:Path>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="none" target="none"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
<edge id="e5" source="n4" target="n2">
<data key="d9"/>
<data key="d10">
<y:PolyLineEdge>
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
<y:Point x="107.36500000000001" y="-315.7942708333334"/>
<y:Point x="107.36500000000001" y="-120.25716145833343"/>
</y:Path>
<y:LineStyle color="#000000" type="line" width="1.0"/>
<y:Arrows source="none" target="none"/>
<y:BendStyle smoothed="false"/>
</y:PolyLineEdge>
</data>
</edge>
</graph>
<data key="d7">
<y:Resources/>
</data>
</graphml>
......@@ -9,7 +9,7 @@
addTest(nsMicroservice_Iface::ITest *p_testClass)
- Add true async in http rest service, that we can send response after handleRequest ends.
*- Add true async in http rest service, that we can send response after handleRequest ends.
// exchange.dispatch(() -> {
// new Timer().schedule(new TimerTask() {
// public void run() {
......@@ -20,3 +20,5 @@
// }
// }, 5000);
// });
- ZMQ : All sockets must be handled from the same thread who created them.
so we can use Rx or my ipc or zmq ipc for event loops
\ No newline at end of file
......@@ -8,8 +8,8 @@ import common.RedisCacheClient;
import com.fasterxml.jackson.databind.JsonNode;
import microservice.io.iface.ICommandClient;
import microservice.io.impl.IRestClientRestImpl;
import microservice.io.iface.IRestClient;
import microservice.io.impl.IRestClientHttpImpl;
import microservice.params.BaseClientParams;
import microservice.params.CommandParams;
......@@ -28,7 +28,7 @@ public class MicroserviceClient
E_RABBITMQ
};
private ICommandClient commandClient = null;
private IRestClient commandClient = null;
private BaseClientParams params = null;
private CacheClient cacheClient = null;
......@@ -38,7 +38,7 @@ public class MicroserviceClient
switch (enumRestClientType)
{
case E_HTTP:
commandClient = new IRestClientRestImpl(params);
commandClient = new IRestClientHttpImpl(params);
break;
case E_RABBITMQ:
break;
......@@ -67,7 +67,7 @@ public class MicroserviceClient
}
public MicroserviceClient(ICommandClient commandClient,
public MicroserviceClient(IRestClient commandClient,
BaseClientParams params) {
super();
this.commandClient = commandClient;
......
......@@ -17,4 +17,6 @@ public class Constants
public static final String INVALID_REQUEST_TOKEN = "invalid request/token";
public static final String AUTHORIZATION_HEADER = "Authorization";
public static final String TYPE_PREFIX_SEPERATOR = ":";
public static final String EXIT_MSG = "exit";
public static final int EXIT_MSG_LEN = EXIT_MSG.length();
}
......@@ -120,11 +120,11 @@ public class CommonServices {
public static abstract class IRestService extends IService {
EnumRestServiceMode serviceMode = EnumRestServiceMode.E_UNKNOWN;
protected ICommandClient restClient = null;
protected microservice.io.iface.IRestClient restClient = null;
public EnumRestServiceMode getServiceMode() { return serviceMode; }
public void setServiceMode(EnumRestServiceMode serviceMode) { this.serviceMode = serviceMode; }
public void setRestClient(ICommandClient restClient) {
public void setRestClient(microservice.io.iface.IRestClient restClient) {
this.restClient = restClient;
}
......
......@@ -9,7 +9,7 @@ import microservice.types.BaseRestResponse;
import java.util.function.Consumer;
public interface ICommandClient
public interface IRestClient
{
static final String COMMAND_ERROR = "Command Error: ";
......
......@@ -3,14 +3,10 @@ package microservice.io.impl;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.netflix.hystrix.contrib.codahalemetricspublisher.HystrixCodaHaleMetricsPublisher;
import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsPoller;
import com.netflix.hystrix.strategy.HystrixPlugins;
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisher;
import http.simpleRestClient.SimpleRestClient;
import http.simpleRestClient.SimpleRestResponse;
import microservice.defs.Enums;
import microservice.io.iface.ICommandClient;
import microservice.io.iface.IRestClient;
import microservice.io.iface.IServiceDiscovery;
import microservice.params.BaseClientParams;
import microservice.params.CommandParams;
......@@ -29,7 +25,7 @@ import java.util.UUID;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.function.Consumer;
public class IRMQClientRestImpl implements ICommandClient
public class IRMQClientRestImpl implements IRestClient
{
private static int REQUEST_TIMEOUT = 30000;
......
package microservice.io.impl;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.function.Consumer;
import com.fasterxml.jackson.databind.deser.Deserializers;
import common.JsonHandler;
import http.StringResponse;
import microservice.MicroserviceApp;
import microservice.defs.Enums;
import microservice.io.iface.ILogger;
import microservice.io.iface.IServiceDiscovery;
import microservice.utils.RestHttpClient;
import rx.Observable;
import rx.Subscriber;
import http.simpleRestClient.SimpleRestClient;
import http.simpleRestClient.SimpleRestResponse;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
......@@ -32,12 +25,12 @@ import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsPoller;
import com.netflix.hystrix.strategy.HystrixPlugins;
import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisher;
import microservice.io.iface.ICommandClient;
import microservice.io.iface.IRestClient;
import microservice.params.BaseClientParams;
import microservice.params.CommandParams;
import microservice.params.RestClientParams;
public class IRestClientRestImpl implements ICommandClient
public class IRestClientHttpImpl implements IRestClient
{
public static final String HYSTRIX_PLUGIN_HYSTRIX_METRICS_PUBLISHER_IMPLEMENTATION = "hystrix.plugin.HystrixMetricsPublisher.implementation";
......@@ -231,7 +224,7 @@ public class IRestClientRestImpl implements ICommandClient
private final ObjectMapper objMapper = new ObjectMapper();
public IRestClientRestImpl(BaseClientParams params) throws Exception
public IRestClientHttpImpl(BaseClientParams params) throws Exception
{
super();
if (RestClientParams.class.isInstance(params))
......@@ -269,7 +262,7 @@ public class IRestClientRestImpl implements ICommandClient
}
}
public IRestClientRestImpl withServiceDiscovery(IServiceDiscovery servDisco)
public IRestClientHttpImpl withServiceDiscovery(IServiceDiscovery servDisco)
{
serviceDiscovery = Optional.ofNullable(servDisco);
return this;
......
......@@ -2,21 +2,58 @@ package microservice.io.impl.service;
import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;
import microservice.MicroserviceApp;
import microservice.common.context.RestContext;
import microservice.defs.Constants;
import microservice.io.iface.*;
import microservice.params.CommandParams;
import microservice.params.ZMQParams;
import microservice.types.BaseRestResponse;
import org.zeromq.ZMQ;
import org.zeromq.ZSocket;
import java.util.function.Consumer;
/**
* Created by amir on 14/05/17.
* <p>
* Implementing the Rest service with ZMQ<br>
* <img src="../../../../../../../doc/ZMQRestService.png" alt="">
* <p>Notes: <br>
* - All ZMQ sockets must be handled from the thread that created them (zmq not thread safe)<br>
* - Each Service has only one destination, for multiple destination create multiple zmq services
* </p>
* </p>
* <p>
* Server Side:<br>
* ZMQ Pull socket receive the msg, validate it and push (inproc) it the Workers<br>
* the worker threads create the {@link RestContext} <br>
* and Delegate it to the {@link microservice.handlers.Reactor}, Upon response, the worker thread<br>
* will send via inproc zmq channel the response with dest socket to the sendReplyThread<br>
* which will take the response , get the zsocket from map and send it.
* </p>
* <p>Client Side:<br>
* Pack message, save the callback lambda in the concurrent cache, send it via ZMQ Push (Thread Local)<br>
* in the client receive thread upon receive ,validate and dispatch it to the ClientWorker<br>
* get the callback lambda from the concurrent map and activate the callback<br>
*
* </p>
*/
public class IRestServiceZmqImpl extends CommonServices.IRestService implements HttpHandler, IContainer {
static final String MAINT_CHANNEL = "inproc://maint";
private String appName;
private String host = null; // the local host address of the service
private String serverBindAddress = null;
private ZMQParams.ServerParams serverParams = null;
private ZSocket serverReceive = null;
private ZSocket serverCommandsSend = null; // to send commands to serverReceive
private ZSocket clientReceive = null;
private ZSocket clientCommandSend = null; // to send commands to clientReceive
private Thread serverReceiveThread = null;
private Thread clientReceiveThread = null;
private ZMQParams.ServerParams clientParams = null;
private String clientBindAddress = null;
private int port = 0; // in case of port like in tcp
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
......@@ -84,17 +121,88 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements
@Override
public boolean init() {
return false;
boolean retstat = true;
this.appName = MicroserviceApp.getsInstance().getAppName();
switch (getServiceMode()){
case E_CLIENT:
break;
case E_SERVER:
retstat = initServer();
break;
case E_CLIENT_SERVER:
retstat = initServer() & initClient();
break;
case E_UNKNOWN:
System.err.println(getClass().getName() + " >> unknown service mode");
retstat = false;
break;
}
return retstat;
}
public boolean initServer() {
serverBindAddress = serverParams.bindAddress();
serverReceive = new ZSocket(ZMQ.PULL);
serverCommandsSend = new ZSocket(ZMQ.PUSH );
return serverReceive.bind(serverBindAddress) &&
serverReceive.bind(MAINT_CHANNEL) &&
serverCommandsSend.connect(MAINT_CHANNEL);
}
public boolean initClient() {
clientBindAddress = clientParams.bindAddress();
clientReceive = new ZSocket(ZMQ.PULL);
clientCommandSend = new ZSocket(ZMQ.PUSH);
return clientReceive.bind(serverBindAddress) &&
clientReceive.bind(MAINT_CHANNEL) &&
clientCommandSend.connect(MAINT_CHANNEL);
}
@Override
public void run() {
switch (getServiceMode()){
case E_CLIENT:
runClientThread();
break;
case E_SERVER:
runServerThread();
break;
case E_CLIENT_SERVER:
runServerThread();
runClientThread();
break;
}
}
private void runServerThread() {
serverReceiveThread = new Thread(() -> {
});
}
private void runClientThread() {
clientReceiveThread = new Thread(() -> {
});
}
@Override
public void shutdown() {
try {
if (clientReceiveThread!= null) {
clientCommandSend.send(Constants.EXIT_MSG.getBytes());
clientReceiveThread.join();
}
if (serverReceiveThread != null){
serverCommandsSend.send(Constants.EXIT_MSG.getBytes());
serverReceiveThread.join();
}
} catch (InterruptedException e) {
System.err.println(e.toString());
}
}
@Override
......@@ -104,7 +212,15 @@ public class IRestServiceZmqImpl extends CommonServices.IRestService implements
@Override
public void register(IServiceDiscovery serviceDiscovery, String id) {
if (serviceDiscovery != null)
serviceDiscovery.registerService(appName, id, host, port);
if (serviceDiscovery != null && serverParams != null)
serviceDiscovery.registerService(appName, id, serverParams.getHost(), serverParams.getPort());
}
public void setServerParams(ZMQParams.ServerParams serverParams) {
this.serverParams = serverParams;
}
public void setClientParams(ZMQParams.ServerParams clientParams) {
this.clientParams = clientParams;
}
}
......@@ -51,7 +51,15 @@ public class ZMQParams {
return bindAddr.toString();
}
String bindAddress() { return buildAddress(host,port,protocol); }
public int getPort() {
return port;
}
public String getHost() {
return host;
}
public String bindAddress() { return buildAddress(host,port,protocol); }
private EnumProtocol protocol;
private int port;
......
......@@ -14,7 +14,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;
import static microservice.io.iface.ICommandClient.COMMAND_ERROR;
import static microservice.io.iface.IRestClient.COMMAND_ERROR;
/**
* Created by amir on 10/05/17.
......
package microservice.utils;
import microservice.io.iface.CommonServices;
import microservice.io.iface.ICommandClient;
import microservice.io.impl.IRestClientRestImpl;
import microservice.io.iface.IRestClient;
import microservice.io.impl.IRestClientHttpImpl;
import microservice.io.impl.service.IRestServiceHttpImpl;
import microservice.io.impl.service.IRestServiceZmqImpl;
import microservice.params.RestClientParams;
......@@ -31,7 +31,7 @@ public class ServiceBuilderFactory {
IRestServiceHttpImpl restServiceHttp = null;
RestServerParams restServerParams = null;
ICommandClient restClient = null;
IRestClient restClient = null;
RestClientParams restClientParams = null;
CommonServices.EnumRestServiceMode serviceMode = CommonServices.EnumRestServiceMode.E_UNKNOWN;
......@@ -54,7 +54,7 @@ public class ServiceBuilderFactory {
* @param restClient
* @return
*/
public RestServiceHttpBuilder withRestClient(ICommandClient restClient) {
public RestServiceHttpBuilder withRestClient(IRestClient restClient) {
this.restClient = restClient;
return this;
......@@ -73,13 +73,13 @@ public class ServiceBuilderFactory {
break;
case E_CLIENT:
if (restClient == null)
restClient = new IRestClientRestImpl(restClientParams);
restClient = new IRestClientHttpImpl(restClientParams);
restServiceHttp.setRestClient(restClient);
break;
case E_CLIENT_SERVER:
restServiceHttp.setRestServerParams(restServerParams);
if (restClient == null)
restClient = new IRestClientRestImpl(restClientParams);
restClient = new IRestClientHttpImpl(restClientParams);
restServiceHttp.setRestClient(restClient);
break;
}
......@@ -159,22 +159,18 @@ public class ServiceBuilderFactory {
restServiceZmq = new IRestServiceZmqImpl();
restServiceZmq.setServiceMode(serviceMode);
// switch (serviceMode) {
// case E_SERVER:
// restServiceZmq.setRestServerParams(restServerParams);
// break;
// case E_CLIENT:
// if (restClient == null)
// restClient = new IRestClientRestImpl(restClientParams);
// restServiceZmq.setRestClient(restClient);
// break;
// case E_CLIENT_SERVER:
// restServiceZmq.setRestServerParams(restServerParams);
// if (restClient == null)
// restClient = new IRestClientRestImpl(restClientParams);
// restServiceZmq.setRestClient(restClient);
// break;
// }
switch (serviceMode) {
case E_SERVER:
restServiceZmq.setServerParams(serverParams);
break;
case E_CLIENT:
restServiceZmq.setClientParams(clientParams);
break;
case E_CLIENT_SERVER:
restServiceZmq.setServerParams(serverParams);
restServiceZmq.setClientParams(clientParams);
break;
}
} catch (Exception exp){
System.err.println(this.getClass().getName().toString() + "Exception >> " + exp);
restServiceZmq = null;
......
......@@ -2,7 +2,7 @@ package microservice;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import microservice.io.iface.ICommandClient;
import microservice.io.iface.IRestClient;
import microservice.io.impl.IRMQClientRestImpl;
import microservice.params.BaseClientParams;
import microservice.params.CommandParams;
......@@ -38,7 +38,7 @@ public class TestCommandClient {
}
public class ASMClient implements ICommandClient
public class ASMClient implements IRestClient
{
ASM asm;
......@@ -55,7 +55,7 @@ public class TestCommandClient {
switch(reqCtx.getEntity())
{
case "AE":
brro = Optional.of((new ICommandClient.Command(reqCtx,"createAE") {
brro = Optional.of((new IRestClient.Command(reqCtx,"createAE") {
@Override
protected BaseRestResponse run() throws Exception {
BaseRestResponse brr = new BaseRestResponse(true, null);
......@@ -66,7 +66,7 @@ public class TestCommandClient {
}).toObservable());
break;
case "Provider":
brro = Optional.of((new ICommandClient.Command(reqCtx,"createProvider") {
brro = Optional.of((new IRestClient.Command(reqCtx,"createProvider") {
@Override
protected BaseRestResponse run() throws Exception {
BaseRestResponse brr = new BaseRestResponse(true, null);
......@@ -96,7 +96,7 @@ public class TestCommandClient {
if ("AE".equals(reqCtx.getEntity()))
{
res = new ICommandClient.Command(reqCtx,"getAE") {
res = new IRestClient.Command(reqCtx,"getAE") {
@Override
protected BaseRestResponse run() throws Exception {
BaseRestResponse brr = new BaseRestResponse(true, null);
......
package microservice;
import microservice.io.iface.ICommandClient;
import microservice.io.impl.IRestClientRestImpl;
import microservice.io.iface.IRestClient;
import microservice.io.impl.IRestClientHttpImpl;
import microservice.io.impl.IServiceDiscoveryConsulImpl;
import org.junit.Test;
import microservice.MicroserviceClient;
import microservice.MicroserviceClient.EnumRestClientType;
import microservice.params.CommandParams;
import microservice.params.RestClientParams;
......@@ -32,9 +31,9 @@ public class TestMicroClient
try
{
ICommandClient cmdClient = new IRestClientRestImpl(clientParams).withServiceDiscovery(serDisco);
IRestClient cmdClient = new IRestClientHttpImpl(clientParams).withServiceDiscovery(serDisco);
client = new MicroserviceClient(cmdClient,clientParams);
new MicroserviceClient(new IRestClientRestImpl(clientParams),clientParams);
new MicroserviceClient(new IRestClientHttpImpl(clientParams),clientParams);
CommandParams cmdParams = new CommandParams("entities", "MCX/entities/lili/person", null, null, null);
System.out.println("Start Testing");
for (int i = 0 ; i < MAX_ITERATION; i++)
......
......@@ -6,7 +6,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import microservice.common.context.RestContext;
import microservice.defs.Enums;
import microservice.io.iface.CommonServices;
import microservice.io.iface.ICommandClient;
import microservice.io.iface.IRestClient;
import microservice.io.impl.*;
import microservice.io.impl.service.IRestServiceHttpImpl;
import microservice.params.*;
......@@ -27,7 +27,7 @@ public class TestMicroserviceApp {
System.setProperty("configFile.location","/opt/mcx/config/config.properties");
BaseClientParams clientParams = new RestClientParams("other-service", true, 10, "localhost:32010","localhost:6379");
final IServiceDiscoveryConsulImpl serDisco = new IServiceDiscoveryConsulImpl("localhost", 8500);
ICommandClient cmdClient = new IRestClientRestImpl(clientParams).withServiceDiscovery(serDisco);
IRestClient cmdClient = new IRestClientHttpImpl(clientParams).withServiceDiscovery(serDisco);
String appName = "testApp";
//ILogger logger = new ILogger4jImpl(appName);
......@@ -52,7 +52,7 @@ public class TestMicroserviceApp {
System.setProperty("configFile.location","/opt/mcx/config/config.properties");
BaseClientParams clientParams = new RestClientParams("other-service", true, 10, "localhost:32010","localhost:6379");
final IServiceDiscoveryConsulImpl serDisco = new IServiceDiscoveryConsulImpl("localhost", 8500);
ICommandClient cmdClient = new IRestClientRestImpl(clientParams).withServiceDiscovery(serDisco);
IRestClient cmdClient = new IRestClientHttpImpl(clientParams).withServiceDiscovery(serDisco);
String appName = "testApp";
//ILogger logger = new ILogger4jImpl(appName);
......
package microservice;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import common.CacheClient;
import common.GuavaCacheClient;
import io.undertow.predicate.Predicate;
import io.undertow.util.PathTemplateMatcher;
import microservice.io.iface.CommonServices;
import org.junit.Test;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;
import java.util.function.BiConsumer;
/**
......@@ -69,4 +77,58 @@ public class TestServicesAndMethods {
// else
// System.out.println("Found match: " + match.getMatchedTemplate());
}
@Test
public void testCache(){
ConcurrentHashMap<String,String> cacheClient = new ConcurrentHashMap<>(1000);
long start = System.currentTimeMillis();
for (int i = 0; i < ITERATIONS; i++) {
cacheClient.put(String.valueOf(i),"REST:GET:/baz/entities/entity/12345");//, 1000);
}
System.out.println("Set Test of: " + String.valueOf(ITERATIONS) +" took (msec): " + String.valueOf(System.currentTimeMillis() - start));
start = System.currentTimeMillis();
String value;
for (int i = 0; i < ITERATIONS; i++) {
value = cacheClient.get(String.valueOf(i));
}
System.out.println("Get Test of: " + String.valueOf(ITERATIONS) +" took (msec): " + String.valueOf(System.currentTimeMillis() - start));
start = System.currentTimeMillis();
for (int i = 0; i < ITERATIONS; i++) {
cacheClient.remove(String.valueOf(i));
}
System.out.println("Remove Test of: " + String.valueOf(ITERATIONS) +" took (msec): " + String.valueOf(System.currentTimeMillis() - start));
/**
* Guava cache
*/
Cache<String, String> gcache = CacheBuilder.newBuilder()
//.maximumSize(10000)
.expireAfterWrite(10, TimeUnit.SECONDS)
//.removalListener(MY_LISTENER)
.build();
start = System.currentTimeMillis();
for (int i = 0; i < ITERATIONS; i++) {
gcache.put(String.valueOf(i),"REST:GET:/baz/entities/entity/12345");//, 1000);
}
System.out.println("Guava Get Test of: " + String.valueOf(ITERATIONS) +" took (msec): " + String.valueOf(System.currentTimeMillis() - start));
start = System.currentTimeMillis();
for (int i = 0; i < ITERATIONS; i++) {
value = gcache.getIfPresent(String.valueOf(i));
if (value == null)
System.err.println("No Value... expired");
}
System.out.println("Get gcache Test of: " + String.valueOf(ITERATIONS) +" took (msec): " + String.valueOf(System.currentTimeMillis() - start));
start = System.currentTimeMillis();
for (int i = 0; i < ITERATIONS; i++) {
gcache.invalidate(String.valueOf(i));
}
System.out.println("Remove gcache Test of: " + String.valueOf(ITERATIONS) +" took (msec): " + String.valueOf(System.currentTimeMillis() - start));
}
}
package microservice;
import com.google.flatbuffers.FlatBufferBuilder;
import itc.ItcMessage;
import itc.ItcMessageQueue;
import microservice.common.context.CrudMethod;
import microservice.common.context.RestMsg;
import microservice.common.context.RestResponse;
import org.junit.Test;
import org.zeromq.ZMQ;
import org.zeromq.ZSocket;
import org.zeromq.*;
import rx.Observable;
import rx.schedulers.Schedulers;
import zmq.Utils;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import static org.junit.Assert.assertEquals;
......@@ -67,6 +77,7 @@ public class TestZMQ {
static final String URI = "/xxx/resource/subResource";
static final String QUERY_STRING = "a=b&c=d&abba=sabba";
public static final int ITERATIONS = 1000;
@Test
public void pushPullTestTCP() throws IOException
......@@ -127,46 +138,15 @@ public class TestZMQ {
serverReceive.bind(ipcAddress1);
serverReply.connect(ipcAddress2);
// int maxSize = 10000;
// serverReceive..set(zmqpp::socket_option::receive_high_water_mark, maxSize);
// serverReply.set(zmqpp::socket_option::send_high_water_mark, maxSize);
// clientReceive.set(zmqpp::socket_option::receive_high_water_mark, maxSize);
// clientSend.set(zmqpp::socket_option::send_high_water_mark, maxSize);
Thread serverThread = new Thread(() -> {
boolean keepRunning = true;
ByteBuffer respBB = ByteBuffer.allocate(1024);
FlatBufferBuilder requestBuilder = new FlatBufferBuilder();
FlatBufferBuilder respBuilder = new FlatBufferBuilder();
while (keepRunning) {
respBuilder.init(respBB);
final byte[] response = serverReceive.receive();
if (response.length > EXIT_MSG_LEN) {
ByteBuffer bb = ByteBuffer.wrap(response);
RestMsg receiveMsg = RestMsg.getRootAsRestMsg(bb);
//respBuilder.Clear();
long rcid = receiveMsg.rcid();
final String content = receiveMsg.content();
int contentOffset = respBuilder.createString(content);
int respSize = RestResponse.createRestResponse(respBuilder,rcid,contentOffset);
RestResponse.finishRestResponseBuffer(respBuilder,respSize);
serverReply.send(respBuilder.sizedByteArray(),ZMQ.DONTWAIT);
} else {
String msg = new String(response);
//std::cout << "Server Received Msg: " << msg << std::endl;
if (msg.equals(EXIT_MSG) ) {
keepRunning = false;
serverReply.send(msg.getBytes(),ZMQ.DONTWAIT);
}
// else if (response.parts() == 2) {
// msg = response.get(1);
// // std::cout << "Server Received Second Msg: " << msg << std::endl;
// serverReply.send(msg, zmqpp::socket::dont_wait);
// }
}
keepRunning = serverRunning(serverReceive, serverReply, keepRunning, respBB, respBuilder);
}
//std::cout << "Server exit.." << std::endl;
});
serverThread.start();
......@@ -177,28 +157,55 @@ public class TestZMQ {
//flatbuffers::FlatBufferBuilder respBuilder(1024);
while (keepRunning) {
//clientReceive.receive(response);
final byte[] response = clientReceive.receive();
try {
keepRunning = clientReceiveAndHandleMsg(clientReceive, keepRunning);
} catch (IOException e) {
e.printStackTrace();
}
}
//std::cout << "Client exit.." << std::endl;
});
clientReceiveThread.start();
//
// Send a single message from serverReceive to clientSend
clientSendMsgs(iterations, clientSend);
clientSend.send(EXIT_MSG.getBytes());
serverThread.join();
// std::cout << "Server exited" << std::endl;
clientReceiveThread.join();
// std::cout << "Client exited" << std::endl;
}
private boolean serverRunning(ZSocket serverReceive, ZSocket serverReply, boolean keepRunning, ByteBuffer respBB, FlatBufferBuilder respBuilder) {
respBuilder.init(respBB);
final byte[] response = serverReceive.receive();
if (response.length > EXIT_MSG_LEN) {
ByteBuffer bb = ByteBuffer.wrap(response);
RestMsg receiveMsg = RestMsg.getRootAsRestMsg(bb);
rcid = receiveMsg.rcid();
//std::cout << "Client Received Msg: " << receiveMsg->objectNode()->c_str() << std::endl;
//respBuilder.Clear();
long rcid = receiveMsg.rcid();
final String content = receiveMsg.content();
int contentOffset = respBuilder.createString(content);
int respSize = RestResponse.createRestResponse(respBuilder,rcid,contentOffset);
RestResponse.finishRestResponseBuffer(respBuilder,respSize);
serverReply.send(respBuilder.sizedByteArray(), ZMQ.DONTWAIT);
// System.out.println("serverRunning on thread " + Thread.currentThread().getName() + " rcid:" + String.valueOf(rcid));
} else {
String msg = new String(response);
//std::cout << "Client Received Msg: " << msg << std::endl;
if (msg.equals(EXIT_MSG))
if (msg.equals(EXIT_MSG) ) {
keepRunning = false;
else
lastNumber = Integer.valueOf(msg);
serverReply.send(msg.getBytes(),ZMQ.DONTWAIT);
// System.out.println("serverRunning on thread " + Thread.currentThread().getName() + " Exit...");
}
}
//std::cout << "Client exit.." << std::endl;
});
clientReceiveThread.start();
return keepRunning;
}
//
// Send a single message from serverReceive to clientSend
int size;
private void clientSendMsgs(int iterations, ZSocket clientSend) {
ByteBuffer reqBB = ByteBuffer.allocate(1024);
FlatBufferBuilder requestBuilder = new FlatBufferBuilder();
for (int i = 0; i < iterations; i++) {
......@@ -213,31 +220,190 @@ public class TestZMQ {
requestBuilder.createString(QUERY_STRING),
requestBuilder.createString(JSON_CONTENT));
RestMsg.finishRestMsgBuffer(requestBuilder,reqSize);
//std::cout << builder.GetSize() << std::endl;
final byte[] bytesToSend = requestBuilder.sizedByteArray();
clientSend.send(bytesToSend,ZMQ.DONTWAIT);
clientSend.send(bytesToSend, ZMQ.DONTWAIT);
}
}
clientSend.send(EXIT_MSG.getBytes());
private boolean clientReceiveAndHandleMsg(ZSocket clientReceive, boolean keepRunning) throws IOException {
long rcid;
int lastNumber;
final byte[] response = clientReceive.receive();
if (response.length > EXIT_MSG_LEN) {
ByteBuffer bb = ByteBuffer.wrap(response);
RestMsg receiveMsg = RestMsg.getRootAsRestMsg(bb);
rcid = receiveMsg.rcid();
//System.out.println("clientReceiveAndHandleMsg on thread " + Thread.currentThread().getName() + " rcid:" + String.valueOf(rcid));
serverThread.join();
// std::cout << "Server exited" << std::endl;
clientReceiveThread.join();
// std::cout << "Client exited" << std::endl;
} else {
String msg = new String(response);
//std::cout << "Client Received Msg: " << msg << std::endl;
if (msg.equals(EXIT_MSG)) {
// System.out.println("clientReceiveAndHandleMsg on thread " + Thread.currentThread().getName() + " Exit...");
keepRunning = false;
}
else
lastNumber = Integer.valueOf(msg);
}
return keepRunning;
}
@Test
public void testPerformance(){
int iterations = 1000000;
final long start = System.currentTimeMillis();
try {
testRequestResponse(iterations);
// testRequestResponse(iterations);
testPushPullMultiple(iterations);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("Test of: " + String.valueOf(iterations) + " took(msec) כולל הקמה ופרוק: " + String.valueOf((System.currentTimeMillis() - start)));
}
@Test
public void testEmitting() throws InterruptedException {
ExecutorService executor = Executors.newFixedThreadPool(20);
Map<String, String> cache = new ConcurrentHashMap<>();
ItcMessageQueue itcMessageQueue = new ItcMessageQueue(100);
final long start = System.currentTimeMillis();
Observable<String> serverOb = Observable.create(emitter -> {
try {
for (int i = 0; i < ITERATIONS + 1; i++) {
final String str = String.valueOf(i);
emitter.onNext(str);
System.out.println(" on thread " + Thread.currentThread().getName() + " " + str);
}
emitter.onCompleted();
} catch (Exception e) {
emitter.onError(e);
}
});
Observable<String> delegateOb = serverOb
.observeOn(Schedulers.from(executor));
delegateOb.forEach(str -> {
System.out.println(" on thread " + Thread.currentThread().getName() + " " + str);
//final String value = cache.get(str);
itcMessageQueue.sendMsg(1,str,null);
try {
Thread.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
// if (value == null){
// cache.put(str,new String(str));
// }
});
new Thread(() -> {
boolean cont = true;
List<ItcMessage> valueList = new ArrayList<>(100);
while (cont) {
//itcMessageQueue.recieveMsgs(valueList, 100);
final ItcMessage itcMessage = itcMessageQueue.recieveMsg(true);
final String msgObj = (String) itcMessage.getMsgObj();
//System.out.println(" on thread " + Thread.currentThread().getName() + " " + msgObj);
if (Integer.valueOf(msgObj).equals(ITERATIONS)) {
System.out.println("Test of: " + String.valueOf(ITERATIONS) + " took (msec): " + String.valueOf(System.currentTimeMillis() - start));
}
}
}).start();
Thread.sleep(20000);
}
public static class ClientSendWorkParams {
public ClientSendWorkParams(final String address) {
clientSend = new ThreadLocal<ZSocket>(){
@Override protected ZSocket initialValue() {
ZSocket socket = new ZSocket(ZMQ.PUSH);
System.out.println("Connectring to:" + address);
if (socket.connect(address) == false) {
System.err.println("Failed Connectring to:" + address);
socket = null;
}
return socket;
}
};
}
private ThreadLocal<ZSocket> clientSend = null;
public ZSocket getSocket() {
return clientSend.get();
}
}
public void testPushPullMultiple(int iterations) throws InterruptedException {
final String ipcFile1 = IPC_FILE1;
final String ipcFile2 = IPC_FILE2;
final int numOfThreads = 10;
//zmqpp::context context;
// create and bind a serverReceive socket
final String ipcAddress1 = "ipc://" + ipcFile1;
final String ipcAddress2 = "ipc://" + ipcFile2;
final ZSocket clientSend = new ZSocket(ZMQ.PUSH);
final ZSocket clientReceive = new ZSocket(ZMQ.PULL);
clientReceive.bind(ipcAddress2);
ClientSendWorkParams clientSendWorkParams = new ClientSendWorkParams(ipcAddress2);
for (int i = 0; i < numOfThreads; i++){
final int queueNum = i;
final String addressRecv = ipcAddress1 + String.valueOf(queueNum);
final String addressReply = ipcAddress2 + String.valueOf(queueNum);
clientSend.connect(addressRecv);
new Thread(() -> {
boolean keepRunning = true;
final ZSocket serverReceive = new ZSocket(ZMQ.PULL);
final ZSocket serverReply = clientSendWorkParams.getSocket(); //new ZSocket(ZMQ.PUSH);
serverReceive.bind(addressRecv);
//serverReply.connect(ipcAddress2);
//System.out.println(" on thread " + Thread.currentThread().getName() + " register to:" + ipcAddress1);
ByteBuffer respBB = ByteBuffer.allocate(1024);
FlatBufferBuilder respBuilder = new FlatBufferBuilder();
while (keepRunning) {
keepRunning = serverRunning(serverReceive, serverReply, keepRunning, respBB, respBuilder);
}
}).start();
}
Thread clientReceiveThread = new Thread(() -> {
boolean keepRunning = true;
while (keepRunning) {
try {
keepRunning = clientReceiveAndHandleMsg(clientReceive, keepRunning);
} catch (IOException e) {
e.printStackTrace();
}
}
});
clientReceiveThread.start();
clientSendMsgs(iterations, clientSend);
clientSend.send(EXIT_MSG.getBytes());
clientReceiveThread.join();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment