org.camunda.bpm.engine.impl.event.CompensationEventHandler Java Examples

The following examples show how to use org.camunda.bpm.engine.impl.event.CompensationEventHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CompensationEventCoverageHandler.java    From camunda-bpm-process-test-coverage with Apache License 2.0 6 votes vote down vote up
/**
 * Implementation for older Camunda versions prior to 7.10.0
 */
public void handleEvent(EventSubscriptionEntity eventSubscription, Object payload, CommandContext commandContext) {
    addCompensationEventCoverage(eventSubscription);

    // invoke super.handleEvent() in a backwards compatible way
    try {
      if (handleEvent == null) {
        handleEvent = MethodHandles.lookup()
            .findSpecial(CompensationEventHandler.class, "handleEvent",
                MethodType.methodType(void.class, EventSubscriptionEntity.class, Object.class, CommandContext.class),
                CompensationEventCoverageHandler.class);
      }
      handleEvent.invoke(this, eventSubscription, payload, commandContext);
    } catch (Throwable e) {
      throw new RuntimeException(e);
    }
}
 
Example #2
Source File: EventSubscriptionEntityHandler.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
@Override
public EventSubscriptionEntity mapToEntity(ODocument doc, EventSubscriptionEntity entity,
		OPersistenceSession session) {
	if(entity==null) {
		String eventType = doc.field("eventType");
		switch (eventType) {
		case CompensationEventHandler.EVENT_HANDLER_TYPE:
			entity = new CompensateEventSubscriptionEntity();
			break;
		case MessageEventSubscriptionEntity.EVENT_TYPE:
			entity = new MessageEventSubscriptionEntity();
			break;
		case SignalEventSubscriptionEntity.EVENT_TYPE:
			entity = new SignalEventSubscriptionEntity();
			break;
		}
	}
	return super.mapToEntity(doc, entity, session);
}
 
Example #3
Source File: ProcessEngineConfigurationImpl.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected void initEventHandlers() {
  if (eventHandlers == null) {
    eventHandlers = new HashMap<>();

    SignalEventHandler signalEventHander = new SignalEventHandler();
    eventHandlers.put(signalEventHander.getEventHandlerType(), signalEventHander);

    CompensationEventHandler compensationEventHandler = new CompensationEventHandler();
    eventHandlers.put(compensationEventHandler.getEventHandlerType(), compensationEventHandler);

    EventHandler messageEventHandler = new EventHandlerImpl(EventType.MESSAGE);
    eventHandlers.put(messageEventHandler.getEventHandlerType(), messageEventHandler);

    EventHandler conditionalEventHandler = new ConditionalEventHandler();
    eventHandlers.put(conditionalEventHandler.getEventHandlerType(), conditionalEventHandler);

  }
  if (customEventHandlers != null) {
    for (EventHandler eventHandler : customEventHandlers) {
      eventHandlers.put(eventHandler.getEventHandlerType(), eventHandler);
    }
  }
}