-
Notifications
You must be signed in to change notification settings - Fork 71
Event Descriptions
These are the AppDirect marketplace events that the SDK allows you to define handles (AppmarketEventHandler
) for (See the Getting started page for details). Each handler has a single handle
method that has te be implemented by the application using the SDK in order to define the connector-specific behavior that gets executed when the event is invoked. When the execution of the custom logic in a given handler is completed (either successfully or not) a message is being sent back to the AppDirect marketplace to signal that the processing of the incoming event has been completed. This message is modeled in the SDK by the ApiResult
class.
By default, when the SDK executes the logic defined in the handle
method of all AppmarketEventHandler
s synchronously: that is, it will call the method, wait for it to complete and send the returned ApiResult
response back to the AppDirect Marketplace in order to mark the event as resolved.
However, if the handle
method described above returns a null value, the SDK assumes that the execution of the
event is going to be done asynchronously. In this case the SDK returns a 202 Accepted
response to the marketplace. In this case, the event is NOT resolved on the marketplace after the response is received. Instead, it is the responsibility to the AppmarketEventHandler
to resolve the event by using the AppmarketEventClient
class, when the event processing is completed (either successfully or erroneously) on the connector. The
AppmarketEventClient.resolve
method then sends the message.
For a listing of all available event types and their significance, see the AppDirect documentation.
- SubscriptionOrder
Signals that the marketplace wants to purchase a subscription;
If the purchase is successful, it is expected that the
ApiResult
returned to the marketplace would have itssuccess
property set totrue
and itsaccountIdentifier
set to the id of the newly created subscription. Note that is it an ID - SubscriptionCancel
- SubscriptionChange
- SubscriptionClosed
- SubscriptionDeactivated
- SubscriptionReactivated
- SubscriptionUpcomingInvoice
- UserAssignment
- UserUnassignment
- AddonSubscriptionOrder
- AddonSubscriptionCancel
Sometimes the processing of a marketplace event fails. In this case, it is the responsibility of each custom AppmarketEventHandler
instance to return the proper error code in its errorCode
field that best describes the error. For details on the meaning of each error code, see the AppDirect developer documentation.
When using the SDK, any exception that is not handled within the AppmarketEventHandler.handle
method of the given handler would cause an event processing failure to be sent back to the marketplace with the UNKNOWN_ERROR
error code. As a SDK user, in order to make it easier to diagnose failures, make sure that you handle know error scenarios in your code and return the most appropriate error code.