A couple of solutions come to mind, to help transition:
1) This one depends on how the events are produced - if SRAMP still needs to issue a query, to create the events, before they are pushed out - then the source query expression could be included in the event definition and match with the query expression configured in the DTGov event receiver. However this means that both SRAMP and DTGov need to be configured with matching queries.
2) If change events are just pushed from SRAMP, with no concept of being pushed as part of a 'category' (i.e. query expression), then I think the DTGov query becomes a predicate over the event, used to determine if it triggers the workflow. So the event definition would include some standard fields, but also adhoc properties, and the query field would define an expression that would access that information to provide a boolean result.
My current preference is (2) - if this was implemented, then sramp query expressions would imply polling (so the existing mechanism could remain supported for a while), otherwise it will be a locally evaluated expression applied to the received event? Although adding a 'trigger type' field may make things more explicit.
brmeyer and I were discussing this more on IRC today and I think I have another transitional approach we could consider. DTGov could do this whenever an event was received:
Get the UUID of the artifact from the event
Execute each configured workflow trigger query, but augment the query's predicate with "@uuid = UUID"
We could probably do some basic initial matching of the event to the query (e.g. if the query includes a model and/or type we can reject a query based on that information from the event).
For example, if the s-ramp query for a given workflow trigger is configured as:
Then we would augment that to become:
/s-ramp/ext/JavaWebApplication[@uuid = 'UUID-GOES-HERE']
Another example - if the query is more complex such as:
/s-ramp/ext/JavaWebApplication[@customProperty1 = 'some-value' or @customProperty2Exists]
Then it would become:
/s-ramp/ext/JavaWebApplication[(@customProperty1 = 'some-value' or @customProperty2Exists) and @uuid = 'UUID-GOES-HERE']
We can actually do this kind of query manipulation easily enough using the s-ramp xpath query parser. I already have POC code that does this.
This would make the queries very targeted (going after a single artifact by its UUID) and very fast. If the artifact matched the query, we would then issue a followup query to see if a workflow had already been created. But that query should also be very fast and targeted.
I think this improves the scalability a lot and we should consider getting this into DTGov 1.3.