fferpcore.MessagingRedeliveryServiceglobal with sharing class MessagingRedeliveryService A messaging redelivery service structure. Methods
canRedeliverglobal static List<fferpcore.MessagingRedeliveryService.CanRedeliverResult> canRedeliver(List<Id> deliveryIds) This method is used to determine if a list of delivery IDs contains any failed deliveries. Input Parameters
Return ValueThis service returns a list of MessagingRedeliveryService.CanRedeliverResult objects. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. List<fferpcore.MessagingDelivery__c>; deliveryObjects = new List<fferpcore.MessagingDelivery__c>(); deliveryObjects.add(new fferpcore.MessagingDelivery__c(State__c = 'Successful')); deliveryObjects.add(new fferpcore.MessagingDelivery__c(State__c = 'Error')); insert deliveryObjects; deliveryObjects = [SELECT Id FROM fferpcore.MessagingDelivery__c]; System.assertEquals(2, deliveryObjects.size); List<fferpcore.MessagingRedeliveryService.CanRedeliverResult> results = fferpcore.MessagingRedeliveryService.canRedeliver(new List<Id>{deliveryObjects[0].Id, deliveryObjects[1].Id}); System.assertEquals(false, results[0].isRedeliverable()); System.assertEquals(true, results[1].isRedeliverable()); redeliverNowglobal static fferpcore.MessagingRedeliveryService.RedeliverNowResult redeliverNow(List<Id> deliveryIds) This method attempts to redeliver any messages for the deliveries provided to it. Input Parameters
Return ValueThis service returns an MessagingRedeliveryService.RedeliverNowResult object. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. List<fferpcore.MessagingDelivery__c> deliveryObjects = new List<fferpcore.MessagingDelivery__c>(); deliveryObjects.add(new fferpcore.MessagingDelivery__c(State__c = 'Successful')); deliveryObjects.add(new fferpcore.MessagingDelivery__c(State__c = 'Error')); //We will assume that this delivery will now pass deliveryObjects.add(new fferpcore.MessagingDelivery__c(State__c = 'Exception')); //We will assume this delivery will still fail insert deliveryObjects; deliveryObjects = [SELECT Id FROM fferpcore.MessagingDelivery__c]; System.assertEquals(3, deliveryObjects.size); fferpcore.MessagingRedeliveryService.RedeliverNowResult results = fferpcore.MessagingRedeliveryService.redeliverNow(new List<Id>{deliveryObjects[0].Id, deliveryObjects[1].Id, deliveryObjects[2].Id}); System.assertEquals(1, results.getNotTriedCount()); //This is for the first delivery System.assertEquals(1, results.getSuccessCount()); //This is for the second delivery System.assertEquals(1, results.getErrorCount()); //This is for the third delivery fferpcore.MessagingRedeliveryService.CanRedeliverResultglobal class CanRedeliverResult A can redeliver result structure. This class is a child class of MessagingRedeliveryService. Methods
CanRedeliverResultglobal CanRedeliverResult(Id deliveryId, Boolean isRedeliverable) This constructor is used to assign a boolean value to a delivery Id to show if this delivery can be retried. Input Parameters
Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. insert new fferpcore.MessagingDelivery__c(State__c = 'Successful'); deliveryObjects = [SELECT Id FROM fferpcore.MessagingDelivery__c]; System.assertEquals(1, deliveryObjects.size); fferpcore.MessagingRedeliveryService.CanRedeliverResult result = new fferpcore.MessagingRedeliveryService.CanRedeliverResult(deliveryObjects[0].Id, false); System.assertEquals(deliveryObjects[0].Id, result.getDeliveryId()); System.assertEquals(false, result.isRedeliverable()); getDeliveryIdglobal Id getDeliveryId() This method is used to return the Id of the delivery that this object is associated to. Return ValueThis service returns an Id object. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. insert new fferpcore.MessagingDelivery__c(State__c = 'Successful'); deliveryObjects = [SELECT Id FROM fferpcore.MessagingDelivery__c]; System.assertEquals(1, deliveryObjects.size); fferpcore.MessagingRedeliveryService.CanRedeliverResult result = new fferpcore.MessagingRedeliveryService.CanRedeliverResult(deliveryObjects[0].Id, false); System.assertEquals(deliveryObjects[0].Id, result.getDeliveryId()); System.assertEquals(false, result.isRedeliverable()); isRedeliverableglobal Boolean isRedeliverable() This method is used to return if the delivery that this object is associated to can be redelivered. Return ValueThis service returns a Boolean object. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. insert new fferpcore.MessagingDelivery__c(State__c = 'Successful'); deliveryObjects = [SELECT Id FROM fferpcore.MessagingDelivery__c]; System.assertEquals(1, deliveryObjects.size); fferpcore.MessagingRedeliveryService.CanRedeliverResult result = new fferpcore.MessagingRedeliveryService.CanRedeliverResult(deliveryObjects[0].Id, false); System.assertEquals(deliveryObjects[0].Id, result.getDeliveryId()); System.assertEquals(false, result.isRedeliverable()); fferpcore.MessagingRedeliveryService.RedeliverNowResultglobal class RedeliverNowResult A redeliver now result structure. This class is a child class of fferpcore.MessagingRedeliveryService Methods
RedeliverNowResultglobal RedeliverNowResult(Integer success, Integer errors) This constructor is used to assign a value to the success and error variables held within this class. The system will pass a Not Tried Count using the three parameter constructor. Input Parameters
Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. fferpcore.MessagingRedeliveryService.RedeliverNowResult result = new fferpcore.MessagingRedeliveryService.RedeliverNowResult(1,2); System.assertEquals(1, results.getSuccessCount()); System.assertEquals(2, results.getErrorCount()); getSuccessCountglobal Integer getSuccessCount() This method returns the number of successful redeliveries. Return ValueThis service returns an Integer object. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. List<fferpcore.MessagingDelivery__c> deliveryObjects = new List<fferpcore.MessagingDelivery__c>(); deliveryObjects.add(new fferpcore.MessagingDelivery__c(State__c = 'Successful')); deliveryObjects.add(new fferpcore.MessagingDelivery__c(State__c = 'Error')); //We will assume that this delivery will now pass deliveryObjects.add(new fferpcore.MessagingDelivery__c(State__c = 'Exception')); //We will assume this delivery will still fail insert deliveryObjects; deliveryObjects = [SELECT Id FROM fferpcore.MessagingDelivery__c]; System.assertEquals(3, deliveryObjects.size); fferpcore.MessagingRedeliveryService.RedeliverNowResult results = fferpcore.MessagingRedeliveryService.redeliverNow(new List<Id>{deliveryObjects[0].Id, deliveryObjects[1].Id, deliveryObjects[2].Id}); System.assertEquals(1, results.getNotTriedCount()); //This is for the first delivery System.assertEquals(1, results.getSuccessCount()); //This is for the second delivery System.assertEquals(1, results.getErrorCount()); //This is for the third delivery getErrorCountglobal Integer getErrorCount() This method returns the number of failed redeliveries. Return ValueThis service returns an Integer object. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. List<fferpcore.MessagingDelivery__c> deliveryObjects = new List<fferpcore.MessagingDelivery__c>(); deliveryObjects.add(new fferpcore.MessagingDelivery__c(State__c = 'Successful')); deliveryObjects.add(new fferpcore.MessagingDelivery__c(State__c = 'Error')); //We will assume that this delivery will now pass deliveryObjects.add(new fferpcore.MessagingDelivery__c(State__c = 'Exception')); //We will assume this delivery will still fail insert deliveryObjects; deliveryObjects = [SELECT Id FROM fferpcore.MessagingDelivery__c]; System.assertEquals(3, deliveryObjects.size); fferpcore.MessagingRedeliveryService.RedeliverNowResult results = fferpcore.MessagingRedeliveryService.redeliverNow(new List<Id>{deliveryObjects[0].Id, deliveryObjects[1].Id, deliveryObjects[2].Id}); System.assertEquals(1, results.getNotTriedCount()); //This is for the first delivery System.assertEquals(1, results.getSuccessCount()); //This is for the second delivery System.assertEquals(1, results.getErrorCount()); //This is for the third delivery getNotTriedCountglobal Integer getNotTriedCount() This method returns the number of redeliveries which weren't tried. Return ValueThis service returns an Integer object. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. List<fferpcore.MessagingDelivery__c> deliveryObjects = new List<fferpcore.MessagingDelivery__c>(); deliveryObjects.add(new fferpcore.MessagingDelivery__c(State__c = 'Successful')); deliveryObjects.add(new fferpcore.MessagingDelivery__c(State__c = 'Error')); //We will assume that this delivery will now pass deliveryObjects.add(new fferpcore.MessagingDelivery__c(State__c = 'Exception')); //We will assume this delivery will still fail insert deliveryObjects; deliveryObjects = [SELECT Id FROM fferpcore.MessagingDelivery__c]; System.assertEquals(3, deliveryObjects.size); fferpcore.MessagingRedeliveryService.RedeliverNowResult results = fferpcore.MessagingRedeliveryService.redeliverNow(new List<Id>{deliveryObjects[0].Id, deliveryObjects[1].Id, deliveryObjects[2].Id}); System.assertEquals(1, results.getNotTriedCount()); //This is for the first delivery System.assertEquals(1, results.getSuccessCount()); //This is for the second delivery System.assertEquals(1, results.getErrorCount()); //This is for the third delivery |