net.rim.pushsdk.acknowledgement
Interface NotificationProcessorService

All Superinterfaces:
Runnable
All Known Implementing Classes:
NotificationProcessorServiceImpl

public interface NotificationProcessorService
extends Runnable

Business logic relating to the processing of result notifications (acknowledgements).

This processing will be asynchronous and threaded.

Author:
mdandrea

Method Summary
 void addNotification(Notification notification)
          Adds a notification to the queue waiting to be processed.
 void destroy()
          Attempts to stop threads when the bean is destroyed.
 int getNotificationProcessorActiveThreadCount()
          Returns the number of threads actively processing notifications.
 int getNotificationProcessorQueueSize()
          Returns the size of the result notification queue.
 int getNotificationProcessorThreadPoolSize()
          Returns the number of threads currently in the thread pool (active and idle).
 int getNotificationProcessorWorkQueueSize()
          Returns the size of the work queue which holds tasks (Runnables) waiting to be picked up and processed using an active thread.
 boolean isResultNotificationQueueFull()
          Determines whether or not the processing queue is already full.
 void processNotifications(List<Notification> notifications)
          Note that this method is used internally by the SDK and should not normally be externally invoked or overridden.
 void reconcile(List<Notification> notifications)
          Note that this method is used internally by the SDK and should not normally be externally invoked or overridden.
 void run()
          Processes a series of notifications from the processing queue.
 void setNotificationListenerService(NotificationListenerService notificationListenerService)
          Support for dependency injection.
 void setPushApplicationService(PushApplicationService pushApplicationService)
          Support for dependency injection.
 void setPushCountService(PushCountService pushCountService)
          Support for dependency injection.
 void setPushRequestDetailService(PushRequestDetailService pushRequestDetailService)
          Support for dependency injection.
 void setPushRequestService(PushRequestService pushRequestService)
          Support for dependency injection.
 void setPushSDKProperties(PushSDKProperties pushSDKProperties)
          Support for dependency injection.
 void setSubscriptionService(SubscriptionService subscriptionService)
          Support for dependency injection.
 

Method Detail

addNotification

void addNotification(Notification notification)
                     throws PushSDKException
Adds a notification to the queue waiting to be processed.

Parameters:
notification - a notification to be processed
Throws:
PushSDKException - if the notification could not be added to the queue because the queue is full

run

void run()
Processes a series of notifications from the processing queue.

The provided implementation builds up a list of notifications from the queue and passes it to the processNotifications method to be processed.

Specified by:
run in interface Runnable

isResultNotificationQueueFull

boolean isResultNotificationQueueFull()
Determines whether or not the processing queue is already full.

Returns:
true if the queue is full; otherwise, false

processNotifications

void processNotifications(List<Notification> notifications)
                          throws PushSDKException
Note that this method is used internally by the SDK and should not normally be externally invoked or overridden. Processes result notifications. It includes the following:
- reconciliation, if the original push was made to the push application with storePushRequest set to true; This includes updating the status of the push request details in the repository - if the original push was made to the push application with autoDeleteRequests set to true; the push request and it's details will be permanently removed from the persistent store
- subscription management (except in the bypassSubscription case): automatically unsubscribe a user when the result notification indicates that the specified address was not recognized by the PPG (i.e. 2002 status code)
- notification of registered listeners (including tracking of the last notification for a given push)

Note: As of version 1.1 of the SDK subscriptions will no longer but automatically unsubscribed on a StatusCode.PORT_CLOSED. In addition it will no longer keep track of the number of consecutive failed push attempts for a given subscriber. This logic will be implemented by version 1.1 of the public/BIS PPG. For enterprise/BES applications it is recommended push initiator's implement this logic in their own applications if required by subclassing the FailureNotificationListener from the acknowledgement component.

Parameters:
notifications - list of value objects that represent notifications
Throws:
PushSDKException - if the result notifications cannot be processed for various reasons

reconcile

void reconcile(List<Notification> notifications)
               throws PushSDKException
Note that this method is used internally by the SDK and should not normally be externally invoked or overridden. Reconciles the result notifications in the back end system.

Parameters:
notifications - list of value objects that represent notifications
Throws:
PushSDKException - if the result notifications cannot be processed for various reasons

getNotificationProcessorQueueSize

int getNotificationProcessorQueueSize()
Returns the size of the result notification queue.

Returns:
the size of the result notification queue

getNotificationProcessorActiveThreadCount

int getNotificationProcessorActiveThreadCount()
Returns the number of threads actively processing notifications.

Returns:
the number of active processing threads

getNotificationProcessorThreadPoolSize

int getNotificationProcessorThreadPoolSize()
Returns the number of threads currently in the thread pool (active and idle).

Returns:
the number of threads in the thread pool

getNotificationProcessorWorkQueueSize

int getNotificationProcessorWorkQueueSize()
Returns the size of the work queue which holds tasks (Runnables) waiting to be picked up and processed using an active thread.

Returns:
the size of the work queue

destroy

void destroy()
Attempts to stop threads when the bean is destroyed.


setPushApplicationService

void setPushApplicationService(PushApplicationService pushApplicationService)
Support for dependency injection. Inject an implementation of a PushApplicationService collaborating object - this is used to interface with the business service that manages push applications.

Parameters:
pushApplicationService - an instance of a PushApplicationService implementation (must be thread safe)

setPushSDKProperties

void setPushSDKProperties(PushSDKProperties pushSDKProperties)
Support for dependency injection. Inject an implementation of a PushSDKProperties collaborating object - this is used to read global configuration properties.

Parameters:
pushSDKProperties - an instance of a PushSDKProperties implementation (must be thread safe)

setPushCountService

void setPushCountService(PushCountService pushCountService)
Support for dependency injection. Inject an implementation of a PushCountService collaborating object - this is used to interface with the business service that manages tracking pushes that are complete.

Parameters:
pushCountService - an instance of a PushCountService implementation (must be thread safe)

setPushRequestDetailService

void setPushRequestDetailService(PushRequestDetailService pushRequestDetailService)
Support for dependency injection. Inject an implementation of a PushRequestDetailService collaborating object - this is used to interface with the business service that manages push request details.

Parameters:
pushRequestDetailService - an instance of a PushRequestDetailService implementation (must be thread safe)

setSubscriptionService

void setSubscriptionService(SubscriptionService subscriptionService)
Support for dependency injection. Inject an implementation of a SubscriptionService collaborating object - this is used to interface with the business service that manages subscribers.

Parameters:
subscriptionService - an instance of a SubscriptionService implementation (must be thread safe)

setPushRequestService

void setPushRequestService(PushRequestService pushRequestService)
Support for dependency injection. Inject an implementation of a PushRequestService collaborating object - this is used to interface with the business service that manages push requests.

Parameters:
pushRequestService - an instance of a PushRequestService implementation (must be thread safe)

setNotificationListenerService

void setNotificationListenerService(NotificationListenerService notificationListenerService)
Support for dependency injection. Inject an implementation of a NotificationListenerService collaborating object - this is used to interface with the business service that manages notifying the acknowledgement listeners.

Parameters:
notificationListenerService - an instance of a NotificationListenerService implementation (must be thread safe)


Copyright © 2011 Research In Motion. All Rights Reserved.