public override BaseElement Clone() { MessageFlow clone = new MessageFlow { Values = this }; return(clone); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void parseModel() public virtual void parseModel() { modelInstance = Bpmn.readModelFromStream(this.GetType().getResourceAsStream(this.GetType().Name + ".xml")); collaboration = modelInstance.getModelElementById(COLLABORATION_ID); participant = modelInstance.getModelElementById(PARTICIPANT_ID + 1); process = modelInstance.getModelElementById(PROCESS_ID + 1); serviceTask = modelInstance.getModelElementById(SERVICE_TASK_ID); exclusiveGateway = modelInstance.getModelElementById(EXCLUSIVE_GATEWAY); startEvent = modelInstance.getModelElementById(START_EVENT_ID + 2); sequenceFlow = modelInstance.getModelElementById(SEQUENCE_FLOW_ID + 3); messageFlow = modelInstance.getModelElementById(MESSAGE_FLOW_ID); dataInputAssociation = modelInstance.getModelElementById(DATA_INPUT_ASSOCIATION_ID); association = modelInstance.getModelElementById(ASSOCIATION_ID); endEvent = modelInstance.getModelElementById(END_EVENT_ID + 2); }
//targetID is the messageID private void GetRoutingDetails(MessageRoutingDetails mrd, Guid targetID) { MessageFlow src = mrd.Source; //the source ArrayList dests = (ArrayList)mrd.Destinations; if (src != null) { Console.WriteLine("Source flow - InstanceID, StartTime, EndTime, ServiceName: "); Console.WriteLine(src.InstanceID + ", " + src.StartTime + ", " + src.EndTime + ", " + src.ServiceName); } Console.WriteLine(); Console.WriteLine("Destination flows - InstanceID, StartTime, EndTime, ServiceName for each destination: "); foreach (MessageFlow dest in dests) { Console.WriteLine(dest.InstanceID + ", " + dest.StartTime + ", " + dest.EndTime + ", " + dest.ServiceName); } }
public static void Main(string[] args) { var factory = new ConnectionFactory() { HostName = MicroServiceConfig.Rabbit_hostname(), UserName = MicroServiceConfig.Rabbit_username(), Password = MicroServiceConfig.Rabbit_password() }; factory.AutomaticRecoveryEnabled = true; factory.NetworkRecoveryInterval = TimeSpan.FromSeconds(10); using (var connection = factory.CreateConnection()) { Console.WriteLine(DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString() + ": Connected"); using (var channel = connection.CreateModel()) { channel.ExchangeDeclare(exchange: "ms.events", type: "topic"); channel.QueueDeclare(queue: "ms.queue.authapi", durable: true, exclusive: false, autoDelete: false, arguments: null); channel.QueueBind("ms.queue.authapi", "ms.events", "#"); channel.BasicQos(0, 1, false); var consumer = new EventingBasicConsumer(channel); consumer.Received += (model, ea) => { var body = ea.Body; try { MessageFlow.HandleEvent("authapi", ea, authApiHub.HandleMessage); channel.BasicAck(ea.DeliveryTag, false); } catch (Exception ex) { System.Threading.Thread.Sleep(1000); //try again in a second... channel.BasicNack(ea.DeliveryTag, false, true); authApiHub.Log($"Event exception: {Monosoft.Common.Utils.ExceptionHelper.GetExceptionAsReportText(ex)}"); } }; channel.BasicConsume("ms.queue.authapi", false, consumer); CreateWebHostBuilder(args).Build().Run(); } } }
public Guid GetDestinationInstanceID(Guid instanceID) { Console.WriteLine("Get instance following " + instanceID + " in the message flow"); MessageFlow messageFlow = _operations.GetMessageFlow(instanceID); Guid destinationID = Guid.Empty; foreach (MessageEvent msgEvent in messageFlow.MessageEvents) { if (msgEvent.EventType == MessageEventType.Sent) { foreach (MessageFlow outFlow in msgEvent.RoutingDetails.Destinations) { destinationID = outFlow.InstanceID; break; } } } Console.WriteLine("Destination ID = " + destinationID); return(destinationID); }
public void AccessMessageFlow(Guid trackingInstID) { PrintSampleName("AccessMessageFlow"); MessageFlow flow = _operations.GetMessageFlow(trackingInstID); Console.WriteLine("Messageflow's instanceID: " + flow.InstanceID); Console.WriteLine(); IEnumerable msgEvents = flow.MessageEvents; foreach (MessageEvent msgevent in msgEvents) { //Some message event properties: Console.Write("Message event details - MessageID, MessageSize, TimeStamp, EventType are: "); Console.WriteLine(msgevent.MessageID + ", " + msgevent.MessageSize + ", " + msgevent.Timestamp + ", " + msgevent.EventType); Console.WriteLine("Message routing details for this event are: "); MessageRoutingDetails mrd = msgevent.RoutingDetails; GetRoutingDetails(mrd, msgevent.MessageID); Console.WriteLine("----------"); } }
public virtual void Parse(XMLStreamReader xtr, BpmnModel model) { string id = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ID); if (!string.IsNullOrWhiteSpace(id)) { MessageFlow messageFlow = new MessageFlow { Id = id }; string name = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_NAME); if (!string.IsNullOrWhiteSpace(name)) { messageFlow.Name = name; } string sourceRef = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FLOW_SOURCE_REF); if (!string.IsNullOrWhiteSpace(sourceRef)) { messageFlow.SourceRef = sourceRef; } string targetRef = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_FLOW_TARGET_REF); if (!string.IsNullOrWhiteSpace(targetRef)) { messageFlow.TargetRef = targetRef; } string messageRef = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_MESSAGE_REF); if (!string.IsNullOrWhiteSpace(messageRef)) { messageFlow.MessageRef = messageRef; } model.AddMessageFlow(messageFlow); } }
internal void ProcessMessageFlow(MessageFlow flow) { Log.Debug("Processing Message Flow {0} in Process Path", new object[] { flow.id }); _addPathEntry(flow.id, flow.sourceRef, flow.targetRef, StepStatuses.Succeeded, DateTime.Now, DateTime.Now); _Complete(flow.id, flow.targetRef); }
private void button2_Click(object sender, EventArgs e) { toolStripStatusLabel1.Text = ""; panel1.CreateGraphics().Clear(Color.Transparent); if (mf != null) { mf.stopFlow(); mf = null; } TextMsgHandler csdtmh = new TextMsgHandler(SignDetectionTextMessageHandler); ADESPanel p1 = new ADESPanel(panel1); TextMsgDisplayProcessor tmdp = new TextMsgDisplayProcessor(new BasicMsgService(null), csdtmh); PanelDisplayProcessor pdp = new PanelDisplayProcessor(p1, new BasicMsgService(null)); MsgConsumer cnn = new NN_Processor(new DispatchMsgService(new MsgConsumer[] { pdp, tmdp }), Constants.SignType.circular); //MsgConsumer tnn = new NN_Processor(new DispatchMsgService(new MsgConsumer[] { pdp, tmdp }), Constants.SignType.triangular); MsgConsumer csdp = new CircularSignDetectorProcessor(new BasicMsgService(cnn), null); //MsgConsumer tsdp = new TriangularSignDetectorProcessor(new BasicMsgService(tnn), null); BitmapMemoryVisionSource bmps = new BitmapMemoryVisionSource(new DispatchMsgService(new MsgConsumer[] { csdp/*, tsdp*/ })); mf = new MessageFlow(); mf.addInitiator(bmps); mf.startFlow(); Bitmap bmp = new Bitmap(imgName); bmps.sendBmp(bmp); }
private void toolStripButton1_Click(object sender, EventArgs e) { if (mf != null) { mf.stopFlow(); mf = null; } ADESPanel p1 = new ADESPanel(panel1); ADESPanel p2 = new ADESPanel(panel2); ADESPanel p3 = new ADESPanel(panel3); ADESPanel p4 = new ADESPanel(panel4); ADESPanel p5 = new ADESPanel(panel5); mf = new MessageFlow(); /* mf.addConsumer(new PanelDisplayProcessor(p1, new UDPMsgService(new UDPAddress[] { new UDPAddress(serviceIP, ServicePort.PANEL_DISPLAY_SP_1) }, null))); mf.addConsumer(new CircularSignDetectorProcessor(new UDPMsgService(new UDPAddress[] { new UDPAddress(serviceIP, ServicePort.SIGN_DETECTION_SP) }, new UDPAddress[] { new UDPAddress(serviceIP, ServicePort.PANEL_DISPLAY_SP_1)}))); mf.addInitiator(new FileVisionSource("C:\\Documents and Settings\\Administrator\\Desktop\\d.avi", new UDPMsgService(null, new UDPAddress[] { new UDPAddress(serviceIP, ServicePort.SIGN_DETECTION_SP)}))); */ PanelDisplayProcessor pdp = new PanelDisplayProcessor(p1, new BasicMsgService(null)); PanelDisplayProcessor pdp2 = new PanelDisplayProcessor(p2, new BasicMsgService(null)); PanelDisplayProcessor pdp3 = new PanelDisplayProcessor(p3, new BasicMsgService(null)); PanelDisplayProcessor pdp4 = new PanelDisplayProcessor(p4, new BasicMsgService(null)); PanelDisplayProcessor pdp5 = new PanelDisplayProcessor(p5, new BasicMsgService(null)); MsgConsumer cnn = null; MsgConsumer tnn = null; if ("NN".Equals(Constants.NN_SVM_SURF)) { cnn = new NN_Processor(new BasicMsgService(pdp4), Constants.SignType.circular); tnn = new NN_Processor(new BasicMsgService(pdp5), Constants.SignType.triangular); } else if ("NN_SURF".Equals(Constants.NN_SVM_SURF) || "NN_12SIMPLE".Equals(Constants.NN_SVM_SURF)) { cnn = new NN_SURFProcessor(new BasicMsgService(pdp4), Constants.SignType.circular); tnn = new NN_SURFProcessor(new BasicMsgService(pdp5), Constants.SignType.triangular); } else if ("SVM_SURF".Equals(Constants.NN_SVM_SURF) || "SVM_12SIMPLE".Equals(Constants.NN_SVM_SURF)) { cnn = new SVM_SURFProcessor(new BasicMsgService(pdp4), Constants.SignType.circular); tnn = new SVM_SURFProcessor(new BasicMsgService(pdp5), Constants.SignType.triangular); } else if ("SVM".Equals(Constants.NN_SVM_SURF) || "SVM_12SIMPLE".Equals(Constants.NN_SVM_SURF)) { MessageBox.Show("SVM Processor not implemented !"); } CircularSignDetectorProcessor csdp = new CircularSignDetectorProcessor(new BasicMsgService(cnn), p2); TriangularSignDetectorProcessor tsdp = new TriangularSignDetectorProcessor(new BasicMsgService(tnn), p3); // CircularSignDetectorProcessor csdp = new CircularSignDetectorProcessor(null, p2); // TriangularSignDetectorProcessor tsdp = new TriangularSignDetectorProcessor(null, p3); LaneDetectorProcessor ldp = new LaneDetectorProcessor(new BasicMsgService(pdp)); //HistogramProcessor hp = new HistogramProcessor(new BasicMsgService(pdp2)); //AForgeProcessor afp = new AForgeProcessor(new HSLFiltering(new IntRange(-30, +30), new DoubleRange(0.0, 1.0), new DoubleRange(0.0, 1.0)), new BasicMsgService(pdp2)); //AutoBrightnessProcessor abp = new AutoBrightnessProcessor(0.5, new Rectangle(256,0,255,287), new BasicMsgService(pdp2)); //HoughLineProcessor htp = new HoughLineProcessor(new BasicMsgService(pdp)); //PanelDisplayProcessor pdp = new PanelDisplayProcessor(p1, new BasicMsgService(null)); //AForgeProcessor afp = new AForgeProcessor(new SpatialColorLabelFilter(new Color[] { Color.White, Color.Red, Color.Blue, Color.Black }), new BasicMsgService(pdp)); // FileVisionSource fvs = new FileVisionSource("D:\\Kml\\PhD\\misc\\signs.avi", new DispatchMsgService(new MsgConsumer[] {pdp, sdp})); //FileVisionSource fvs = new FileVisionSource(@"C:\java\eclipse\workspace\PhD_utils\resimler\avi\all_sign.avi", new DispatchMsgService(new MsgConsumer[] { laneDetectionToolStripMenuItem.Checked ? (MsgConsumer)ldp : (MsgConsumer)pdp, csdp, tsdp })); FileVisionSource fvs = new FileVisionSource(@"C:\java\eclipse\workspace\PhD_utils\resimler\avi\all_sign.avi", new DispatchMsgService(new MsgConsumer[] { ldp })); // FileVisionSource fvs = new FileVisionSource("D:\\Kml\\PhD\\PhD Thesis\\media\\all_sign.avi", new DispatchMsgService(new MsgConsumer[] { pdp, csdp, tsdp })); // DeviceVisionSource dvs = new DeviceVisionSource(new DispatchMsgService(new MsgConsumer[] { pdp, sdp })); mf.addInitiator(fvs); mf.startFlow(); Globals.TIME_START_MILLISEC = DateTime.Now.Ticks / 10000; }
internal void ProcessMessageFlow(MessageFlow flow) { _WriteLogLine(flow.id, LogLevels.Debug, "Processing Message Flow in Process Path"); _addPathEntry(flow.id, flow.sourceRef, flow.targetRef, StepStatuses.Succeeded, DateTime.Now, DateTime.Now); _Complete(flow.id, flow.targetRef); }
private void AdesDlg_Load(object sender, EventArgs e) { Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); cmbES.SelectedIndex = 0; serverHost.Text = getLocalIP(); imgServerHost.Text = getLocalIP(); unreal = new Unreal(appPath.Text); // Init ADES messageFlow for vision ADESPanel p1 = new ADESPanel(panel1); TextMsgHandler csdtmh = new TextMsgHandler(circularSignDetectionTextMessageHandler); mf = new MessageFlow(); TextMsgDisplayProcessor tmdp = new TextMsgDisplayProcessor(new BasicMsgService(null), csdtmh); PanelDisplayProcessor pdp = new PanelDisplayProcessor(p1, new BasicMsgService(null)); MsgConsumer cnn = new NN_Processor(new DispatchMsgService(new MsgConsumer[]{pdp, tmdp}), Constants.SignType.circular); CircularSignDetectorProcessor csdp = new CircularSignDetectorProcessor(new BasicMsgService(cnn), null); bmvs = new BitmapMemoryVisionSource(new BasicMsgService(csdp)); mf.addInitiator(bmvs); mf.startFlow(); }
public static void OnMessageFlow(string message) { MessageFlow?.Invoke(message); }
public static void WriteBPMNDI(BpmnModel model, XMLStreamWriter xtw) { // BPMN DI information xtw.WriteStartElement(BpmnXMLConstants.BPMNDI_PREFIX, BpmnXMLConstants.ELEMENT_DI_DIAGRAM, BpmnXMLConstants.BPMNDI_NAMESPACE); string processId; if ((model.Pools?.Count).GetValueOrDefault() > 0) { processId = "Collaboration"; } else { processId = model.MainProcess.Id; } xtw.WriteAttribute(BpmnXMLConstants.ATTRIBUTE_ID, "BPMNDiagram_" + processId); xtw.WriteStartElement(BpmnXMLConstants.BPMNDI_PREFIX, BpmnXMLConstants.ELEMENT_DI_PLANE, BpmnXMLConstants.BPMNDI_NAMESPACE); xtw.WriteAttribute(BpmnXMLConstants.ATTRIBUTE_DI_BPMNELEMENT, processId); xtw.WriteAttribute(BpmnXMLConstants.ATTRIBUTE_ID, "BPMNPlane_" + processId); foreach (string elementId in model.LocationMap.Keys) { if (model.GetFlowElement(elementId) != null || model.GetArtifact(elementId) != null || model.GetPool(elementId) != null || model.GetLane(elementId) != null) { xtw.WriteStartElement(BpmnXMLConstants.BPMNDI_PREFIX, BpmnXMLConstants.ELEMENT_DI_SHAPE, BpmnXMLConstants.BPMNDI_NAMESPACE); xtw.WriteAttribute(BpmnXMLConstants.ATTRIBUTE_DI_BPMNELEMENT, elementId); xtw.WriteAttribute(BpmnXMLConstants.ATTRIBUTE_ID, "BPMNShape_" + elementId); GraphicInfo graphicInfo = model.GetGraphicInfo(elementId); FlowElement flowElement = model.GetFlowElement(elementId); if (flowElement is SubProcess && graphicInfo.Expanded != null) { xtw.WriteAttribute(BpmnXMLConstants.ATTRIBUTE_DI_IS_EXPANDED, graphicInfo.Expanded.ToString()); } xtw.WriteStartElement(BpmnXMLConstants.OMGDC_PREFIX, BpmnXMLConstants.ELEMENT_DI_BOUNDS, BpmnXMLConstants.OMGDC_NAMESPACE); xtw.WriteAttribute(BpmnXMLConstants.ATTRIBUTE_DI_HEIGHT, "" + graphicInfo.Height); xtw.WriteAttribute(BpmnXMLConstants.ATTRIBUTE_DI_WIDTH, "" + graphicInfo.Width); xtw.WriteAttribute(BpmnXMLConstants.ATTRIBUTE_DI_X, "" + graphicInfo.X); xtw.WriteAttribute(BpmnXMLConstants.ATTRIBUTE_DI_Y, "" + graphicInfo.Y); xtw.WriteEndElement(); xtw.WriteEndElement(); } } foreach (string elementId in model.FlowLocationMap.Keys) { if (model.GetFlowElement(elementId) != null || model.GetArtifact(elementId) != null || model.GetMessageFlow(elementId) != null) { xtw.WriteStartElement(BpmnXMLConstants.BPMNDI_PREFIX, BpmnXMLConstants.ELEMENT_DI_EDGE, BpmnXMLConstants.BPMNDI_NAMESPACE); xtw.WriteAttribute(BpmnXMLConstants.ATTRIBUTE_DI_BPMNELEMENT, elementId); xtw.WriteAttribute(BpmnXMLConstants.ATTRIBUTE_ID, "BPMNEdge_" + elementId); IList <GraphicInfo> graphicInfoList = model.GetFlowLocationGraphicInfo(elementId) ?? new List <GraphicInfo>(); foreach (GraphicInfo graphicInfo in graphicInfoList) { xtw.WriteStartElement(BpmnXMLConstants.OMGDI_PREFIX, BpmnXMLConstants.ELEMENT_DI_WAYPOINT, BpmnXMLConstants.OMGDI_NAMESPACE); xtw.WriteAttribute(BpmnXMLConstants.ATTRIBUTE_DI_X, "" + graphicInfo.X); xtw.WriteAttribute(BpmnXMLConstants.ATTRIBUTE_DI_Y, "" + graphicInfo.Y); xtw.WriteEndElement(); } GraphicInfo labelGraphicInfo = model.GetLabelGraphicInfo(elementId); if (labelGraphicInfo != null) { FlowElement flowElement = model.GetFlowElement(elementId); MessageFlow messageFlow = null; if (flowElement == null) { messageFlow = model.GetMessageFlow(elementId); } bool hasName = false; if (flowElement != null && !string.IsNullOrWhiteSpace(flowElement.Name)) { hasName = true; } else if (messageFlow != null && !string.IsNullOrWhiteSpace(messageFlow.Name)) { hasName = true; } if (labelGraphicInfo != null && hasName) { xtw.WriteStartElement(BpmnXMLConstants.BPMNDI_PREFIX, BpmnXMLConstants.ELEMENT_DI_LABEL, BpmnXMLConstants.BPMNDI_NAMESPACE); xtw.WriteStartElement(BpmnXMLConstants.OMGDC_PREFIX, BpmnXMLConstants.ELEMENT_DI_BOUNDS, BpmnXMLConstants.OMGDC_NAMESPACE); xtw.WriteAttribute(BpmnXMLConstants.ATTRIBUTE_DI_HEIGHT, "" + labelGraphicInfo.Height); xtw.WriteAttribute(BpmnXMLConstants.ATTRIBUTE_DI_WIDTH, "" + labelGraphicInfo.Width); xtw.WriteAttribute(BpmnXMLConstants.ATTRIBUTE_DI_X, "" + labelGraphicInfo.X); xtw.WriteAttribute(BpmnXMLConstants.ATTRIBUTE_DI_Y, "" + labelGraphicInfo.Y); xtw.WriteEndElement(); xtw.WriteEndElement(); } } xtw.WriteEndElement(); } } // end BPMN DI elements xtw.WriteEndElement(); xtw.WriteEndElement(); }
public virtual void MessageFlow(C context, MessageFlow mystruct) { }
public static void Main(string[] args) { var factory = new ConnectionFactory() { HostName = MicroServiceConfig.Rabbit_hostname(), UserName = MicroServiceConfig.Rabbit_username(), Password = MicroServiceConfig.Rabbit_password() }; factory.AutomaticRecoveryEnabled = true; factory.NetworkRecoveryInterval = TimeSpan.FromSeconds(10); using (var connection = factory.CreateConnection()) { Console.WriteLine(DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString() + ": Connected"); using (var channel = connection.CreateModel()) { channel.ExchangeDeclare(exchange: "ms.events", type: "topic"); channel.QueueDeclare(queue: "ms.queue.clusterapi", durable: true, exclusive: false, autoDelete: false, arguments: null); channel.QueueBind("ms.queue.clusterapi", "ms.events", "#"); channel.BasicQos(0, 1, false); var consumer = new EventingBasicConsumer(channel); consumer.Received += (model, ea) => { var body = ea.Body; try { MessageFlow.HandleEvent("clusterapi", ea, clusterApiHub.HandleMessage); } catch (Exception ex) { Console.WriteLine("ex: " + ex.Message); } finally { channel.BasicAck(ea.DeliveryTag, false); } }; channel.BasicConsume("ms.queue.clusterapi", false, consumer); CreateWebHostBuilder(args).Build().Run(); } using (var channel = connection.CreateModel()) { channel.ExchangeDeclare(exchange: "ms.request", type: "topic");//ms.request? eller ms.auth.request? channel.QueueDeclare(queue: "ms.queue.forwardauthapi", durable: true, exclusive: false, autoDelete: false, arguments: null); channel.QueueBind("ms.queue.forwardauthapi", "ms.request", "token.#"); channel.QueueBind("ms.queue.forwardauthapi", "ms.request", "servicestore.#"); channel.BasicQos(0, 1, false); var consumer = new EventingBasicConsumer(channel); consumer.Received += (model, ea) => { byte[] response = null; var body = ea.Body; var props = ea.BasicProperties; var replyProps = channel.CreateBasicProperties(); replyProps.CorrelationId = props.CorrelationId; try { response = MessageFlow.HandleMessage("clusterapi", ea, Program.FowardMessage /*send via signalR*/); } catch (Exception ex) { Console.WriteLine("ex: " + ex.Message); } finally { channel.BasicAck(ea.DeliveryTag, false); if (props != null && props.ReplyTo != null) { channel.BasicPublish( exchange: string.Empty, routingKey: props.ReplyTo, basicProperties: replyProps, body: response); Console.WriteLine(DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString() + ": RPC responded"); } } }; channel.BasicConsume("ms.queue.forwardauthapi", false, consumer); CreateWebHostBuilder(args).Build().Run(); } } }