AnsweredAssumed Answered

Dynamic REST Endpoints

Question asked by thensgens on Apr 27, 2014
Latest reply on May 5, 2014 by thensgens

what I'd like add to Activiti are 'dynamic REST endpoints' within a process engine's life-time.
Let me elaborate on that topic first:

I want to add new elements to the set of 'Activiti BPMN symbols'. That itself is not a huge problem since the editor provides this feature pretty much ootb.
Now, if the engine executed/parsed such an extended diagram (and its new symbols), I'd like to add new endpoints dynamically which could then be consumed by REST clients.
So, for instance, after parsing a certain symbol, the endpoint 'http://localhost:8192/activiti/services/cars' should be available.

Currently Activiti provides a (static) REST API for querying deployments/diagrams etc. and provides a stand-alone module for deployment: activiti-rest.
However, I cannot really use that one since it's not in the same context as e.g. the activiti-explorer.
One would have to add the endpoint *after* a certain diagram is parsed, and I don't see how that could be achieved while the two are segregated.
According to Tomcat's documentation there's 'cross-context dispatching', but 'm not really sure if that's feasible in this context.

What would be a reasonable approach in this scenario? Maybe creating a new (activiti) module and sharing its code in the depending project (e.g. activiti-explorer) would be a good solution. Even though I'm not sure how I could hold an instance of that server/restlet since it'll be instanced by the servlet-container (after startup), but I'd have to have an instance because I need to create new endpoints dynamically.

Thanks in advance.