Search in sources :

Example 1 with MessageEventDefinition

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);
}
Also used : MessageEventDefinition(org.camunda.bpm.model.bpmn.instance.MessageEventDefinition)

Example 2 with 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();
}
Also used : SequenceBuilder(org.camunda.bpm.model.xml.type.child.SequenceBuilder) ModelElementTypeBuilder(org.camunda.bpm.model.xml.type.ModelElementTypeBuilder) MessageEventDefinition(org.camunda.bpm.model.bpmn.instance.MessageEventDefinition) EventDefinition(org.camunda.bpm.model.bpmn.instance.EventDefinition) MessageEventDefinition(org.camunda.bpm.model.bpmn.instance.MessageEventDefinition) ModelTypeInstanceContext(org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)

Example 3 with MessageEventDefinition

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;
}
Also used : MessageEventDefinition(org.camunda.bpm.model.bpmn.instance.MessageEventDefinition)

Example 4 with MessageEventDefinition

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;
}
Also used : MessageEventDefinition(org.camunda.bpm.model.bpmn.instance.MessageEventDefinition)

Example 5 with MessageEventDefinition

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());
}
Also used : MessageEventDefinition(org.camunda.bpm.model.bpmn.instance.MessageEventDefinition) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) Job(org.camunda.bpm.engine.runtime.Job) ParseException(java.text.ParseException)

Aggregations

MessageEventDefinition (org.camunda.bpm.model.bpmn.instance.MessageEventDefinition)5 ParseException (java.text.ParseException)1 Job (org.camunda.bpm.engine.runtime.Job)1 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)1 EventDefinition (org.camunda.bpm.model.bpmn.instance.EventDefinition)1 ModelTypeInstanceContext (org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)1 ModelElementTypeBuilder (org.camunda.bpm.model.xml.type.ModelElementTypeBuilder)1 SequenceBuilder (org.camunda.bpm.model.xml.type.child.SequenceBuilder)1