Try out the message name

Hi all, I have the following problem: my application polls a mail folder. If a mail arrives, some data are extracted from it, and a “message start event” has to be triggered. However, the application contains several of those events, and from the content of the mail it is not possible to determine which one is actually the appropriate one.

All I can extract from the mail is the business key. So I’m looking for a way to determine the name of message start event at which the process identified by the business key is waiting.

I hoped it was possible to try them out. But I get a MismatchingMessageCorrelationException - I had hoped it would return null and leave it to me to decide whether this is a faulty attempt or not.

Has anybody an idea?
Kind regards,
Christian

Hi Christian,

Can’t you just catch the exception and then treat it as if null was returned?

Cheers,
Thorben

Hi Thorben, that was one thing I had tried out. But the exceptions print their stack trace into the logging. This makes it almost impossible to distinguish in the logging between “real” exceptions and the ones from this trying around.

You can set the engine configuration flag enableCmdExceptionLogging to false to avoid that all exceptions are logged when the engine throws them. For exceptions that you don’t handle, your runtime environment will most likely still log them anyway, so you shouldn’t lose any information.

2 Likes

I finally found a solution: my application does not only store Camunda stuff in its database, it has quite a complex object graph that is stored with JPA / Hibernate. In this object graph, I can identify things with the business key. The business key is really unique for all process instances. So, I added some informations into my object graph, and from them I now can determine the correct message name.

Works really swimmingly.