Greeting,
I am trying to create a subscription manually via Java API.
All that I managed to find here is:
ExecutionEntity executionEntity = (ExecutionEntity)context;
EventSubscriptionEntity eventSubscriptionEntity = new EventSubscriptionEntity(executionEntity, EventType.MESSAGE);
eventSubscriptionEntity.setEventName(eventName);
eventSubscriptionEntity.setActivity(executionEntity.getActivity());
eventSubscriptionEntity.insert();
However inser
method put a subscription to cache
rather than to db
:
public void insert(DbEntity dbEntity) {
// generate Id if not present
ensureHasId(dbEntity);
validateId(dbEntity);
// put into cache
dbEntityCache.putTransient(dbEntity);
}
Sometimes it cause MismatchingMessageCorrelationException
when we try to correlate like here:
camunda.getRuntimeService().createMessageCorrelation(message.getMessageType())
.processInstanceBusinessKey(message.getTraceId())
.setVariable(//
"PAYLOAD_" + message.getMessageType(), //
SpinValues.jsonValue(message.getPayload().toString()).create())//
.correlateWithResult();
because RuntimeService
is not able to find the subscription.
My questions are:
- Is there public API to make a subscription?
- If mentioned above way is a single one, how can I flush cache in
MyJavaDelegate
?
Thank you in advance,
Mike