I am trying to use intermididate catching event in my process definition, but only want to signal it based on condition. I can see signalExpression is there inside catching event but bpmn modelere is not allowing me to use this.
I posted similar question os stack overflow https://stackoverflow.com/questions/60350138/signalexpression-in-activiti-6-0-intermediate-catching-...
Can someone help.
Solved! Go to Solution.
Hi,
Clearly the signal expression is not a standard BPMN and is an extension. To make it work this is what I had to do.
BpmnXMLConverter.addConverter(new CatchEventXMLConverter() { @Override protected void writeSignalDefinition(Event parentEvent, SignalEventDefinition signalDefinition, XMLStreamWriter xtw) throws Exception { xtw.writeStartElement(ELEMENT_EVENT_SIGNALDEFINITION); writeDefaultAttribute("activiti:"+ATTRIBUTE_SIGNAL_EXPRESSION, signalDefinition.getSignalExpression(), xtw); if (parentEvent instanceof ThrowEvent && signalDefinition.isAsync()) { BpmnXMLUtil.writeQualifiedAttribute(ATTRIBUTE_ACTIVITY_ASYNCHRONOUS, "true", xtw); } boolean didWriteExtensionStartElement = BpmnXMLUtil.writeExtensionElements(signalDefinition, false, xtw); if (didWriteExtensionStartElement) { xtw.writeEndElement(); } xtw.writeEndElement(); } });
getProcessEngineConfiguration()) .setActivityBehaviorFactory(new DefaultActivityBehaviorFactory() { @Override public IntermediateCatchSignalEventActivityBehavior createIntermediateCatchSignalEventActivityBehavior( IntermediateCatchEvent intermediateCatchEvent, SignalEventDefinition signalEventDefinition, Signal signal) { return new IntermediateCatchSignalEventActivityBehavior(signalEventDefinition, signal) { private static final long serialVersionUID = 1L; @Override public void execute(DelegateExecution execution) { CommandContext commandContext = Context.getCommandContext(); ExecutionEntity executionEntity = (ExecutionEntity) execution; String signalName = null; Expression signalExpression = commandContext.getProcessEngineConfiguration().getExpressionManager() .createExpression(signalEventDefinition.getSignalExpression()); signalName = signalExpression.getValue(execution).toString(); commandContext.getEventSubscriptionEntityManager().insertSignalEvent(signalName, signal, executionEntity); } }; } })
Thanks
-Vishal
Hi @vgaur,
I see on Stack that someone chipped in - looks like you have resolved your issue? If so, it would be great if you could update this post with how you resolved your problem.
Many thanks,
Hi,
Clearly the signal expression is not a standard BPMN and is an extension. To make it work this is what I had to do.
BpmnXMLConverter.addConverter(new CatchEventXMLConverter() { @Override protected void writeSignalDefinition(Event parentEvent, SignalEventDefinition signalDefinition, XMLStreamWriter xtw) throws Exception { xtw.writeStartElement(ELEMENT_EVENT_SIGNALDEFINITION); writeDefaultAttribute("activiti:"+ATTRIBUTE_SIGNAL_EXPRESSION, signalDefinition.getSignalExpression(), xtw); if (parentEvent instanceof ThrowEvent && signalDefinition.isAsync()) { BpmnXMLUtil.writeQualifiedAttribute(ATTRIBUTE_ACTIVITY_ASYNCHRONOUS, "true", xtw); } boolean didWriteExtensionStartElement = BpmnXMLUtil.writeExtensionElements(signalDefinition, false, xtw); if (didWriteExtensionStartElement) { xtw.writeEndElement(); } xtw.writeEndElement(); } });
getProcessEngineConfiguration()) .setActivityBehaviorFactory(new DefaultActivityBehaviorFactory() { @Override public IntermediateCatchSignalEventActivityBehavior createIntermediateCatchSignalEventActivityBehavior( IntermediateCatchEvent intermediateCatchEvent, SignalEventDefinition signalEventDefinition, Signal signal) { return new IntermediateCatchSignalEventActivityBehavior(signalEventDefinition, signal) { private static final long serialVersionUID = 1L; @Override public void execute(DelegateExecution execution) { CommandContext commandContext = Context.getCommandContext(); ExecutionEntity executionEntity = (ExecutionEntity) execution; String signalName = null; Expression signalExpression = commandContext.getProcessEngineConfiguration().getExpressionManager() .createExpression(signalEventDefinition.getSignalExpression()); signalName = signalExpression.getValue(execution).toString(); commandContext.getEventSubscriptionEntityManager().insertSignalEvent(signalName, signal, executionEntity); } }; } })
Thanks
-Vishal
Hi @vgaur,
Thanks for posting your solution - really helpful to other hub members.
Kind regards,
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.