Uploaded image for project: 'Marathon'
  1. Marathon
  2. MARATHON-6972

Added event subscriptions endpoint

    Details

    • Type: Task
    • Status: Resolved
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      Ref MGI-147

      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

      Also, I would like to note that I used optional injection on EventSubscriptionsResource for realizing conditional injection.

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              GitHub_everpeace Shingo Omura (Inactive)
              Team:
              Orchestration Team
              Watchers:
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: