vendredi 19 avril 2019

How to send a response (json to UI) every time the streaming ews makes a callback to my code?

I have created a poc for exchange web service in java. I have created a streaming notification from an exchange service. so whenever the mailbox in exchange server gets a new mail in it, the exchange server will call my callback method. But how should i return the response everytime the server makes a callback call.

Code snippet:

List<FolderId> folderIds = new ArrayList<FolderId>();
folderIds.add(new FolderId(WellKnownFolderName.Inbox));
folderIds.add(new FolderId(WellKnownFolderName.DeletedItems));
StreamingSubscription streamingSubscription = exchangeService.subscribeToStreamingNotifications(folderIds,EventType.Created, EventType.NewMail);

StreamingSubscriptionConnection streamingConn = new 
StreamingSubscriptionConnection(exchangeService, 30);
streamingConn.addSubscription(streamingSubscription);
streamingConn.addOnNotificationEvent((sender, notification) -> {
    // send response to ui every time this callback method is called.
});

Aucun commentaire:

Enregistrer un commentaire