## Event notification to callBackUrl (not an API on EFC)

EFC creates an outbound http connection to the callBackUrl.
Content-type: multipart/form-data
Body: Each of the Event parameters are set as separate form field, and each metadata param also is a form field. The body/payload of the event is another form field.
Names of the various form fields are -

- Event parameters -family, type, eventId, subscriptionId, version, producerName, producerVersion, publicationTimestamp
- Event Metadata parameters - metadata-user, metadata-correlationId
  Any other metadata key-value pairs present in the event would also be set as separate form fields as metadata-key1, metadata-key4, etc.
- Event Body - eventBody

Content-type: application/json
Body: Event is represented as a json string
json schema for the event :

    {
      "type" : "object",
      "properties" : {
        "eventMetaData" : {
          "type" : "object",
          "properties" : {
            "user" : {
              "type" : "string"
            },
            "correlationId" : {
              "type" : "string"
            },
            "producerName" : {
              "type" : "string"
            },
            "producerVersion" : {
              "type" : "string"
            }
          }
        },
        "eventBody" : {},
        "type" : {
          "type" : "string"
        },
        "version" : {
          "type" : "string"
        },
        "family" : {
          "type" : "string"
        },
        "eventId" : {
          "type" : "string"
        },
        "subscriptionId" : {
          "type" : "string"
        },
        "version" : {
       	  "type" : "string"
        },
        "publicationTimestamp" : {
       	  "type" : "string"
        }
      }
    }

Sample body :

    {
        "eventId": "c94-EventingConnect-3.5.0.0.0-80487300-6bb8-4aeb-a84a-7115f27a1d4a.EventingConnect-PREFERRED-6882fa8c1beb5bd0c2906e389dd158c3b544d8c3c60d2a082a71036388775ade",
        "family": "f1",
        "publicationTimestamp": 1509704278271,
        "eventMetaData": {
            "additionalProperties": {
                "k2": "v2",
                "k1": "v1"
            },
            "user": "u131",
            "producerVersion": "1.0",
            "producerName": "MyApp"
        },
        "version": "1.0",
        "eventBody": {
            "a": "a1",
            "ar1": {
                "abcd": "pqrs",
                "iar1": {
                    "x2": "y2",
                    "x1": "y1"
                },
                "xyz": "123"
            },
            "b": "b1"
        },
        "subscriptionId": "EventingConnect-PREFERRED-6882fa8c1beb5bd0c2906e389dd158c3b544d8c3c60d2a082a71036388775ade",
        "type": "t2"
    }

- While trying to create a subscription, the callBackUrl is validated by sending an HTTP POST to it with a dummy data for which the remote subscriber needs to respond back with a 200 OK.
- If the callbackContentType is multipart/form-data, this dummy data has a single part with part name "callbackUrl" and value same as the callbackUrl present in subscription request, like "http://example.com:9988/myApp/myResource"
- If the callbackContentType is application/json this dummy data looks like this -

      {
          "callbackUrl":"http://example.com:9988"
      }

- A success/failure event may be sent asynchronously for the subscription, depending on the subscription family.
- When an event is about to expire user will receive SUBSCRIPTION_EXPIRING event. User will then have to send a request to renew the subscription.

## Flow Chart for events sent from EFC:

Copyright © 2017 Avaya. All Rights Reserved.