use of org.camunda.bpm.model.bpmn.instance.MessageEventDefinition in project camunda-bpmn-model by camunda.
the class AbstractThrowEventBuilder method messageEventDefinition.
/**
* Creates an empty message event definition with the given id
* and returns a builder for the message event definition.
*
* @param id the id of the message event definition
* @return the message event definition builder object
*/
public MessageEventDefinitionBuilder messageEventDefinition(String id) {
MessageEventDefinition messageEventDefinition = createEmptyMessageEventDefinition();
if (id != null) {
messageEventDefinition.setId(id);
}
element.getEventDefinitions().add(messageEventDefinition);
return new MessageEventDefinitionBuilder(modelInstance, messageEventDefinition);
}
use of org.camunda.bpm.model.bpmn.instance.MessageEventDefinition in project camunda-bpmn-model by camunda.
the class MessageEventDefinitionImpl method registerType.
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(MessageEventDefinition.class, BPMN_ELEMENT_MESSAGE_EVENT_DEFINITION).namespaceUri(BPMN20_NS).extendsType(EventDefinition.class).instanceProvider(new ModelElementTypeBuilder.ModelTypeInstanceProvider<MessageEventDefinition>() {
public MessageEventDefinition newInstance(ModelTypeInstanceContext instanceContext) {
return new MessageEventDefinitionImpl(instanceContext);
}
});
messageRefAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_MESSAGE_REF).qNameAttributeReference(Message.class).build();
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
operationRefChild = sequenceBuilder.element(OperationRef.class).qNameElementReference(Operation.class).build();
/**
* camunda extensions
*/
camundaClassAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_CLASS).namespace(CAMUNDA_NS).build();
camundaDelegateExpressionAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_DELEGATE_EXPRESSION).namespace(CAMUNDA_NS).build();
camundaExpressionAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_EXPRESSION).namespace(CAMUNDA_NS).build();
camundaResultVariableAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_RESULT_VARIABLE).namespace(CAMUNDA_NS).build();
camundaTopicAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_TOPIC).namespace(CAMUNDA_NS).build();
camundaTypeAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_TYPE).namespace(CAMUNDA_NS).build();
camundaTaskPriorityAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_TASK_PRIORITY).namespace(CAMUNDA_NS).build();
typeBuilder.build();
}
use of org.camunda.bpm.model.bpmn.instance.MessageEventDefinition in project camunda-bpmn-model by camunda.
the class AbstractThrowEventBuilder method message.
/**
* Sets an event definition for the given message name. If already a message
* with this name exists it will be used, otherwise a new message is created.
*
* @param messageName the name of the message
* @return the builder object
*/
public B message(String messageName) {
MessageEventDefinition messageEventDefinition = createMessageEventDefinition(messageName);
element.getEventDefinitions().add(messageEventDefinition);
return myself;
}
use of org.camunda.bpm.model.bpmn.instance.MessageEventDefinition in project camunda-bpmn-model by camunda.
the class AbstractCatchEventBuilder method message.
/**
* Sets an event definition for the given message name. If already a message
* with this name exists it will be used, otherwise a new message is created.
*
* @param messageName the name of the message
* @return the builder object
*/
public B message(String messageName) {
MessageEventDefinition messageEventDefinition = createMessageEventDefinition(messageName);
element.getEventDefinitions().add(messageEventDefinition);
return myself;
}
use of org.camunda.bpm.model.bpmn.instance.MessageEventDefinition in project camunda-bpm-platform by camunda.
the class FoxJobRetryCmdTest method testRetryOnServiceTaskLikeMessageThrowEvent.
public void testRetryOnServiceTaskLikeMessageThrowEvent() {
// given
BpmnModelInstance bpmnModelInstance = Bpmn.createExecutableProcess("process").startEvent().intermediateThrowEvent().camundaAsyncBefore().camundaFailedJobRetryTimeCycle("R10/PT5S").messageEventDefinition("messageDefinition").message("message").messageEventDefinitionDone().endEvent().done();
MessageEventDefinition messageDefinition = bpmnModelInstance.getModelElementById("messageDefinition");
messageDefinition.setCamundaClass(FailingDelegate.class.getName());
deployment(bpmnModelInstance);
runtimeService.startProcessInstanceByKey("process");
Job job = managementService.createJobQuery().singleResult();
// when job fails
try {
managementService.executeJob(job.getId());
} catch (Exception e) {
// ignore
}
// then
job = managementService.createJobQuery().singleResult();
Assert.assertEquals(9, job.getRetries());
}
Aggregations