Affects Version/s: None
Fix Version/s: None
I added below endpoint
- endpoint path => /v2/event_subscriptions
- supported methods =>
- POST with ?callback_url<br/> returns whether registration was succeeded or not. <br/>And, this api call will be also notified subscribers (including callee).
- DELETE with ?callback_url<br/> returns whether un-registration was succeeded or not. <br/> And, this api call will be also notified subscribers (excluding callee).
- GET <br/> returns list of subscribers. <br/> And, this api call will NOT be notified. ( I know that Event-Bus says that "Marathon has an internal event bus that captures all API requests and scaling events.")
In this modification, I made some changes to Marathon's core components below:
- message EventSubscribers was added to marathon.proto. (so, Protos.java was also regenerated. I compile marathon.proto with protobuf 2.4.1 and mesos 0.15.0, as specified in pom.xml)
- MarathonStore was slightly modified:
- change prefix to be customizable.
- modify(key)( ( () => S ) => S ) was instroduced.
- () =>S returns deserialized S value, which enables to avoid unnecessary deserialization overhead.
- consequently, store(key,value) was implemented as modify(key)(_=>newvalue) at PersistenceStore
Api resources must be always published because http requests to marathon instance will be forwarded to the leader as you mentioned even when --event_subscriber was NOT specified at startup.
However, EventSubscriptionResource depends on HttpCallbackSubscriptionService. And, dependencies of HttpCallbackSubscriptionService are initialized only when --event_subscriber http_callback is specified at startup. Therefore, if the normal @Inject annotation was used, Guice raises an initialization exception during instantiating HttpCallbackSubscriptionService. Optional injection can avoid this.