cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic REST Endpoints

thensgens
Champ in-the-making
Champ in-the-making
Hello,

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.
1 REPLY 1

thensgens
Champ in-the-making
Champ in-the-making
Okay, let's take a step back.
Firstly, I want to extend the activiti modeler (add new custom activities). In order to get these new elements to work, I'd have to extend the engine (runtime, parser, deployer) itself.
I've looked into the code for quite a while now, but it still seems to be rather complicated at the moment. Is there any documentation besides the 'User Guide' and the (rather) short 'Developers Guide' (http://docs.codehaus.org/display/ACT/Developers+Guide)?

From my understanding I'd have to extend the XMLConverter and the BPMNModel itself, in order to have a correct runtime representation of the new elements (during/after the deployment procedure).
Apparently, the BPMNParseHandlers (and the '…Behavior classes' for that matter) are solely relevant for runtime purposes. They'd have to adjusted as well if one wants to add  the possibility of running these processes later on.

It would be very helpful if anyone could provide an overview of the relevant classes/packages for this use case in particular.