Foundations Apex API Developer Reference

fferpcore.MessagingSystemService

global with sharing class MessagingSystemService

This class is the main entry point for the Foundations Messaging System. Developers can invoke the deliverNow and deliverLater methods to send messages.

Methods

deliverNow

global static fferpcore.MessagingSystemService.DeliverNowResult deliverNow(String sendingProductDeveloperName, List<fferpcore.MessagingSystemService.MessageRequest> requests)

Deliver messages synchronously. Messages will have been handled by the recipient before this method returns. This allows immediate communication and, through reply messages, results to be made available immediately. It risks exceeding limits as recipient code runs in the same execution context. As no Product Proxy is specified, it is assumed messages are being sent from the default (managed) Product Proxy.

Input Parameters

Name Type Description
sendingProductDeveloperName String The name of the product that is sending the messages.
requests List<fferpcore.MessagingSystemService.MessageRequest> The message requests

Return Value

This class always returns an fferpcore.DeliverNowResult with no content.

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.MessagingSystemService.MessageRequest> messageRequests = new List<fferpcore.MessagingSystemService.MessageRequest>();
messageRequests.add(new fferpcore.MessagingSystemService.MessageRequest('messageTypeDeveloperName', 'correlationId', 'body'));

fferpcore.MessagingSystemService.deliverNow('productDeveloperName', messageRequests);

// Can execute code here knowing that the messages have been handled by the subscribers.

deliverNow

global static fferpcore.MessagingSystemService.DeliverNowResult deliverNow(String productDeveloperName, String messageTypeDeveloperName, fferpcore.DataSource dataSource)

This method is a convenient way to build messages using the MessageDescriptionService, then use deliverNow to deliver them. This method may avoid generating messages if it will not be possible to send them.

Input Parameters

Name Type Description
productDeveloperName String The name of the product that is sending the messages, as used with fferpcore.RegistrationService.
messageTypeDeveloperName String The developer name of the Message Type to generate messages for.
dataSource fferpcore.DataSource Input data to use to generate the messages.

Return Value

This class always returns an fferpcore.DeliverNowResult with no content.

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.

trigger SampleTrigger on Sample__c (after insert, after update)
{
    // Prevent an infinite loop by not sending a message in response to a message.
    if (!fferpcore.MessagingSystemService.isInDelivery())
    {
        // Provide the new or updated records as a DataSource for message generation.
        fferpcore.DataSource dataSource = new fferpcore.TriggerDataSource(Trigger.New);

        // Send the messages.
        fferpcore.MessagingSystemService.deliverNow('ProductName', 'MessageTypeName', dataSource);

        // Can execute code here knowing that the messages have been handled by the subscribers.
    }
}

deliverNow

global static fferpcore.MessagingSystemService.DeliverNowResult deliverNow(fferpcore.MessagingSystemService.Sender sender, List<fferpcore.MessagingSystemService.MessageRequest> requests)

Deliver messages synchronously. Messages will have been handled by the recipient before this method returns. This allows immediate communication and, through reply messages, results to be made available immediately. It risks exceeding limits as recipient code runs in the same execution context.

Input Parameters

Name Type Description
sender fferpcore.MessagingSystemService.Sender The Product and ProductProxy publishing these messages.
requests List<fferpcore.MessagingSystemService.MessageRequest> The message requests.

Return Value

This class always returns an fferpcore.DeliverNowResult with no content.

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.MessagingSystemService.MessageRequest> messageRequests = new List<fferpcore.MessagingSystemService.MessageRequest>();
messageRequests.add(new fferpcore.MessagingSystemService.MessageRequest('messageTypeDeveloperName', 'correlationId', 'body'));
fferpcore.MessagingSystemService.Sender sender = new fferpcore.MessagingSystemService.Sender('ProductDevName');

fferpcore.MessagingSystemService.deliverNow(sender, messageRequests);

// Can execute code here knowing that the messages have been handled by the subscribers.

deliverNow

global static fferpcore.MessagingSystemService.DeliverNowResult deliverNow(fferpcore.MessagingSystemService.Sender sender, fferpcore.MessagingSystemService.MessageTypeSpecifier messageTypeSpecifier, fferpcore.DataSource dataSource)

This method is a convenient way to build messages using the MessageDescriptionService, then use deliverNow to deliver them. This method may avoid generating messages if it will not be possible to send them.

Input Parameters

Name Type Description
sender fferpcore.MessagingSystemService.Sender The Product and ProductProxy publishing these messages.
messageTypeSpecifier fferpcore.MessagingSystemService.MessageTypeSpecifier The MessageType and Identifier we are sending.
dataSource fferpcore.DataSource Input data to use to generate the messages.

Return Value

This class always returns an fferpcore.DeliverNowResult with no content.

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.

trigger SampleTrigger on Sample__c (after insert, after update)
{
    // Prevent an infinite loop by not sending a message in response to a message.
    if (!fferpcore.MessagingSystemService.isInDelivery())
    {
        // Provide the new or updated records as a DataSource for message generation.
        fferpcore.DataSource dataSource = new fferpcore.TriggerDataSource(Trigger.New);

        fferpcore.MessagingSystemService.Sender sender = new fferpcore.MessagingSystemService.Sender('ProductDevName');
        fferpcore.MessagingSystemService.MessageTypeSpecifier messageTypeSpecifier = new fferpcore.MessagingSystemService.Sender('Resource.Update', 'Sample__c');

        // Send the messages.
        fferpcore.MessagingSystemService.deliverNow(sender, messageTypeSpecifier, dataSource);

        // Can execute code here knowing that the messages have been handled by the subscribers.
    }
}

pushVirtualRecordEvent

global static fferpcore.MessagingSystemService.DeliverNowResult pushVirtualRecordEvent(fferpcore.MessagingSystemService.VirtualRecordEventRequest request)

Send the appropriate Provider and associated RecordList, to any Consumers on the specified message type.

Input Parameters

Name Type Description
request fferpcore.MessagingSystemService.VirtualRecordEventRequest Data concerning the operation including the Sender, Message Type, and Record IDs.

Return Value

A DeliverNowResult containing correlation IDs and the number of errors and recipients.

isInDelivery

global static Boolean isInDelivery()

Return Value

True if a delivery is currently in progress.

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.

/**
 * @return true if the report was successfully created
 */
public Boolean createExpensesReport()
{
    //If the messaging system is still delivering messages, we shouldn't do the report as we won't have all the data we want
    if(fferpcore.MessagingSystemService.isInDelivery())
    {
        return false;
    }

    //Actually create report
    ...
}

deliverLater

global static fferpcore.MessagingSystemService.DeliverLaterResult deliverLater(String sendingProductDeveloperName, List<fferpcore.MessagingSystemService.MessageRequest> requests)

Send messages asynchronously. For each message, if the sending product is enabled to send to the message's message type, then a MessagingMessage__c is created for later delivery by the batch message delivery system.

Input Parameters

Name Type Description
sendingProductDeveloperName String The name of the product that is sending the messages.
requests List<fferpcore.MessagingSystemService.MessageRequest> The message requests.

Return Value

This class always returns an fferpcore.DeliverLaterResult with no content.

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.MessagingSystemService.MessageRequest> messageRequests = new List<fferpcore.MessagingSystemService.MessageRequest>();
messageRequests.add(new fferpcore.MessagingSystemService.MessageRequest('messageTypeDeveloperName', 'correlationId', 'body'));

fferpcore.MessagingSystemService.deliverLater('productDeveloperName', messageRequests);

deliverLater

global static fferpcore.MessagingSystemService.DeliverLaterResult deliverLater(String productDeveloperName, String messageTypeDeveloperName, fferpcore.DataSource dataSource)

Convenience method to build messages using the MessageDescriptionService, then use deliverLater to deliver them. This method may avoid generating messages if it will not be possible to send them.

Input Parameters

Name Type Description
productDeveloperName String The name of the product that is sending the messages, as used with fferpcore.RegistrationService.
messageTypeDeveloperName String The developer name of the Message Type to generate messages for.
dataSource fferpcore.DataSource Input data to use to generate the messages.

Return Value

This class always returns an fferpcore.DeliverLaterResult with no content.

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.

trigger SampleTrigger on Sample__c (after insert, after update)
{
    // Prevent an infinite loop by not sending a message in response to a message.
    if (!fferpcore.MessagingSystemService.isInDelivery())
    {
        // Provide the new or updated records as a DataSource for message generation.
        fferpcore.DataSource dataSource = new fferpcore.TriggerDataSource(Trigger.New);

        // Send the messages. They will be saved to the DB now. The subscription handlers will process them later.
        fferpcore.MessagingSystemService.deliverLater('ProductName', 'MessageTypeName', dataSource);
    }
}

deliverLater

global static fferpcore.MessagingSystemService.DeliverLaterResult deliverLater(fferpcore.MessagingSystemService.Sender sender, List<fferpcore.MessagingSystemService.MessageRequest> requests)

Send messages asynchronously. For each message, if the sending product is enabled to send to the message's message type, then a MessagingMessage__c is created for later delivery by the batch message delivery system.

Input Parameters

Name Type Description
sender fferpcore.MessagingSystemService.Sender The Product and ProductProxy publishing these messages.
requests List<fferpcore.MessagingSystemService.MessageRequest> The message requests.

Return Value

This class always returns an fferpcore.DeliverLaterResult with no content.

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.MessagingSystemService.MessageRequest> messageRequests = new List<fferpcore.MessagingSystemService.MessageRequest>();
messageRequests.add(new fferpcore.MessagingSystemService.MessageRequest('messageTypeDeveloperName', 'correlationId', 'body'));
fferpcore.MessagingSystemService.Sender sender = new fferpcore.MessagingSystemService.Sender('ProductDevName');

fferpcore.MessagingSystemService.deliverLater(sender, messageRequests);

deliverLater

global static fferpcore.MessagingSystemService.DeliverLaterResult deliverLater(fferpcore.MessagingSystemService.Sender sender, fferpcore.MessagingSystemService.MessageTypeSpecifier messageTypeSpecifier, fferpcore.DataSource dataSource)

Convenience method to build messages using the MessageDescriptionService, then use deliverLater to deliver them. This method may avoid generating messages if it will not be possible to send them.

Input Parameters

Name Type Description
sender fferpcore.MessagingSystemService.Sender The Product and ProductProxy publishing these messages.
messageTypeSpecifier fferpcore.MessagingSystemService.MessageTypeSpecifier The MessageType and Identifier we are sending.
dataSource fferpcore.DataSource Input data to use to generate the messages.

Return Value

This class always returns an fferpcore.DeliverLaterResult with no content.

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.

trigger SampleTrigger on Sample__c (after insert, after update)
{
    // Prevent an infinite loop by not sending a message in response to a message.
    if (!fferpcore.MessagingSystemService.isInDelivery())
    {
        // Provide the new or updated records as a DataSource for message generation.
        fferpcore.DataSource dataSource = new fferpcore.TriggerDataSource(Trigger.New);

        fferpcore.MessagingSystemService.Sender sender = new fferpcore.MessagingSystemService.Sender('ProductDevName');
        fferpcore.MessagingSystemService.MessageTypeSpecifier messageTypeSpecifier = new fferpcore.MessagingSystemService.Sender('Resource.Update', 'Sample__c');

        // Send the messages. They will be saved to the DB now. The subscription handlers will process them later.
        fferpcore.MessagingSystemService.deliverLater(sender, messageTypeSpecifier, dataSource);
    }
}

deliverLaterUsingBatch

global static fferpcore.MessagingSystemService.DeliverLaterResult deliverLaterUsingBatch(fferpcore.MessagingSystemService.Sender sender, fferpcore.MessagingSystemService.MessageTypeSpecifier specifier, SObjectType objectType, String queryCondition, Integer scopeSize)

Create a batch job to asynchronously queue a large volume of messages for future delivery.

Input Parameters

Name Type Description
sender fferpcore.MessagingSystemService.Sender The Product and ProductProxy publishing these messages.
specifier fferpcore.MessagingSystemService.MessageTypeSpecifier The MessageType and Identifier we are sending.
objectType SObjectType The SObject type of the records.
queryCondition String The condition used to locate suitable records. For example, "WHERE Value__c > 100".
scopeSize Integer The number of records to process in each batch chunk.

Return Value

This class always returns an fferpcore.DeliverLaterResult with no content.

newResponseCapturingScope

global static fferpcore.Disposable newResponseCapturingScope(fferpcore.MessagingSystemService.ResponseCapturingRequest request)

Enables synchronous responses to messages to be captured and processed in a single delivery. Deliveries for the specified subscriptions are collected for processing when the scope is disposed of. This enables more efficient processing when a synchronous request generates synchronous responses from several recipients. If a response capturing scope is not used, then each set of responses to the original request are processed separately. Each set of responses then generates their own SOQL and DML overhead.
This method enables a preinitialised handler to process the messages. If a handler is specified as null, the subscription's own handler is instantiated and used. Handlers are invoked according to their delivery order.
To receive messages, enable the subscription in the Foundations Setup application. If the subscription is not enabled, no messages are delivered.
You must dispose of the generated scope using the try-finally pattern. If the scope is not disposed of, this might result in loss of message logging and batch messages.

Input Parameters

Name Type Description
request fferpcore.MessagingSystemService.ResponseCapturingRequest The request detailing which subscriptions to capture messages for.

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.

/**
 * Sends a message requesting voting responses from several recipients.
 * Collects the responses into a single delivery for efficient processing.
 */
global class VotingExample
{
    private static final fferpcore.MessagingSystemService.Sender MYSELF =
            new fferpcore.MessagingSystemService.Sender('ExampleProduct');

    private static final fferpcore.MessagingSystemService.MessageTypeSpecifier REQUEST_MESSAGE_TYPE =
            new fferpcore.MessagingSystemService.MessageTypeSpecifier('Samples.Voting.Request');

    private static final fferpcore.MessagingSystemService.MessageTypeSpecifier RESPONSE_MESSAGE_TYPE =
            new fferpcore.MessagingSystemService.MessageTypeSpecifier('Samples.Voting.Response');

    /**
     * Request that a vote be taken. Tally the responses and create a record.
     */
    public void collectVotes(String question)
    {
        // Use of a pre-initialised handler allows a result to be captured for the calling method.
        VoteHandler handler = new VoteHandler(question);

        fferpcore.Disposable scope = fferpcore.MessagingSystemService.newResponseCapturingScope(
                new fferpcore.MessagingSystemService.ResponseCapturingRequest()
                .forSubscription(MYSELF, RESPONSE_MESSAGE_TYPE, handler)
        );
        try
        {
            fferpcore.MessagingSystemService.deliverNow(MYSELF,
                    new List<fferpcore.MessagingSystemService.MessageRequest>{
                        new fferpcore.MessagingSystemService.MessageRequest(REQUEST_MESSAGE_TYPE, null, question)
                    });
        }
        finally
        {
            // Responses are processed here. The handler's onMessages method will only
            // be called once.
            scope.dispose();
        }
    }

    /**
     * The message handler to use for the Response messages.
     */
    global class VoteHandler implements fferpcore.MessageHandler
    {
        private final String m_question;

        /**
         * This constructor is used by FinancialForce ERP Core when the handler receives a message
         * outside the capturing scope.
         */
        global VoteHandler()
        {
            m_question = 'No question was asked!';
        }

        /**
         * This constructor is used in the collectVotes method above.
         */
        public VoteHandler(String question)
        {
            m_question = question;
        }

        /**
         * Implementation of the onMessages method from the fferpcore.MessageHandler interface.
         */
        global void onMessages(fferpcore.HandleMessagesRequest request)
        {
            Integer yes = 0, no = 0, spoiled = 0;

            for(fferpcore.DeliveredMessage message : request.getMessages())
            {
                String response = message.getBody();
                if(response == 'Yes')
                {
                    yes++;
                }
                else if(response == 'No')
                {
                    no++;
                }
                else
                {
                    spoiled++;
                    message.respondError(new fferpcore.ErpErrorBody('Vote was not recognised.'));
                }
            }

            insert new VotingResult__c(
                    Question__c = m_question,
                    Yes__c = yes,
                    No__c = no,
                    Spoiled__c = spoiled
            );
        }
    }
}

isInBatchDelivery

global static Boolean isInBatchDelivery()

Return Value

True if a batch job is currently in progress.

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.

/** 
 * A MessageHandler's onMessages method will be invoked when the subscription it is associated to
 * receives messages from a publication of the same message type.
 */
public class ExampleHandler implements fferpcore.MessageHandler
{
    public void onMessages(fferpcore.HandleMessagesRequest request)
    {
        for(fferpcore.DeliveredMessage message : request.getMessages())
        {
            s_deliveredMessages.add(message);

            message.respondSuccess();

            if(fferpcore.MessagingSystemService.isInBatchDelivery())
            {
                //Code when this handler receiving messages is in batch
            }
        }
    }
}

isDormant

global static Boolean isDormant()

Return Value

True if the current endpoints would cause no new messages to be sent. Dormant does not prevent delivery. of existing messages.

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.

if (!fferpcore.MessagingSystemService.isDormant())
{
    //Create messages and requests.
    
}

canDeliver

global static Map<fferpcore.MessagingSystemService.MessageTypeSpecifier, Boolean> canDeliver(fferpcore.MessagingSystemService.Sender sender, Set<fferpcore.MessagingSystemService.MessageTypeSpecifier> specifiers)

Determines whether delivery can take place for the sender and message type specifiers provided.

Input Parameters

Name Type Description
sender fferpcore.MessagingSystemService.Sender The sender that is to deliver the messages.
specifiers Set<fferpcore.MessagingSystemService.MessageTypeSpecifier> The message types with which to deliver the messages.

Return Value

A map of each message type specifier with a boolean indicating whether delivery is possible for that message type specifier.

fferpcore.MessagingSystemService.VirtualRecordEventRequest

global inherited sharing class VirtualRecordEventRequest

Data necessary for the pushVirtualRecordEvent method.

Methods

VirtualRecordEventRequest

global VirtualRecordEventRequest(fferpcore.MessagingSystemService.Sender sender, fferpcore.MessagingSystemService.MessageTypeSpecifier messageType, Set<String> virtualRecordIds)

Construct a VirtualRecordEventRequest.

Input Parameters

Name Type Description
sender fferpcore.MessagingSystemService.Sender The product responsible for sending the data.
messageType fferpcore.MessagingSystemService.MessageTypeSpecifier The message type on which to send the data.
virtualRecordIds Set<String> The IDs of the Records to obtain using the Provider.

withSharingModel

global fferpcore.MessagingSystemService.VirtualRecordEventRequest withSharingModel(fferpcore.SharingModel sharingModel)

Specify the sharing policy to be used by the resulting Provider.

Input Parameters

Name Type Description
sharingModel fferpcore.SharingModel The policy to be used.

getSharingModel

global fferpcore.SharingModel getSharingModel()

Return Value

The sharing policy to be used by the resulting Provider.

withSourceObjectErrorListener

global fferpcore.MessagingSystemService.VirtualRecordEventRequest withSourceObjectErrorListener(fferpcore.VirtualDataObject.ErrorListener errorListener)

Specify an ErrorListener to be notified if any errors are added to the source Records.

Input Parameters

Name Type Description
errorListener fferpcore.VirtualDataObject.ErrorListener The ErrorListener to be invoked in case of error.

getSourceObjectErrorListeners

global List<fferpcore.VirtualDataObject.ErrorListener> getSourceObjectErrorListeners()

Return Value

The ErrorListeners to be notified when errors are added to the source Records.

getSender

global fferpcore.MessagingSystemService.Sender getSender()

Return Value

The product responsible for sending the data.

getMessageTypeSpecifier

global fferpcore.MessagingSystemService.MessageTypeSpecifier getMessageTypeSpecifier()

Return Value

The message type on which to send the data.

getVirtualRecordIds

global Set<String> getVirtualRecordIds()

Return Value

The IDs of the Records to obtain using the Provider.

fferpcore.MessagingSystemService.ResponseCapturingRequest

global inherited sharing class ResponseCapturingRequest

Contains a request to capture synchronous responses so that they can be processed in a single delivery.

Methods

ResponseCapturingRequest

global ResponseCapturingRequest()

Constructs a Response Capturing Request.

forSubscription

global fferpcore.MessagingSystemService.ResponseCapturingRequest forSubscription(fferpcore.EndpointKey endpoint)

Captures responses for the given subscription using its preconfigured handler.

Return Value

The ResponseCapturingRequest. This enables other methods to be invoked.

forSubscription

global fferpcore.MessagingSystemService.ResponseCapturingRequest forSubscription(fferpcore.EndpointKey endpoint, fferpcore.MessageHandler handler)

Captures responses for the given subscription using a preinitialized handler.

Return Value

The ResponseCapturingRequest. This enables other methods to be invoked.

forSubscription

global fferpcore.MessagingSystemService.ResponseCapturingRequest forSubscription(fferpcore.MessagingSystemService.Sender sender, fferpcore.MessagingSystemService.MessageTypeSpecifier messageType)

Captures responses for the given subscription using its preconfigured handler.

Input Parameters

Name Type Description
sender fferpcore.MessagingSystemService.Sender The product and proxy that own the subscription.
messageType fferpcore.MessagingSystemService.MessageTypeSpecifier The message type name and identifier of the subscription.

Return Value

The ResponseCapturingRequest. This enables other methods to be invoked.

forSubscription

global fferpcore.MessagingSystemService.ResponseCapturingRequest forSubscription(fferpcore.MessagingSystemService.Sender sender, fferpcore.MessagingSystemService.MessageTypeSpecifier messageType, fferpcore.MessageHandler handler)

Captures responses for the given subscription using a preinitialized handler.

Input Parameters

Name Type Description
sender fferpcore.MessagingSystemService.Sender The product and proxy that own the subscription.
messageType fferpcore.MessagingSystemService.MessageTypeSpecifier The message type name and identifier of the subscription.
handler fferpcore.MessageHandler The handler instance with which to process captured messages.

Return Value

The ResponseCapturingRequest. This enables other methods to be invoked.

createScope

global fferpcore.Disposable createScope()

Provides a convenient way to call MessagingSystemService.newResponseCapturingScope() with this request.

Return Value

The created capturing scope.

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.Disposable scope = new fferpcore.MessagingSystemService.ResponseCapturingRequest()
    .forSubscription(MYSELF, RESPONSE_MESSAGE_TYPE, handler)
    .createScope();

fferpcore.MessagingSystemService.MessageRequest

global inherited sharing virtual class MessageRequest

A request to send a Message.

Methods

MessageRequest

global MessageRequest(String messageTypeDeveloperName, String correlationId, String body)

Input Parameters

Name Type Description
messageTypeDeveloperName String The message type to send this message to.
correlationId String A string that identifies related messages.
body String The message content.

MessageRequest

global MessageRequest(fferpcore.MessagingSystemService.MessageTypeSpecifier messageTypeSpecifier, String correlationId, String body)

Input Parameters

Name Type Description
messageTypeSpecifier fferpcore.MessagingSystemService.MessageTypeSpecifier An object that combines the MessageType and a Identifier
correlationId String A string that identifies related messages.
body String The message content.

getMessageTypeDeveloperName

global String getMessageTypeDeveloperName()

Return Value

The developer name of the message type associated with this request.

getMessageTypeSpecifier

global virtual fferpcore.MessagingSystemService.MessageTypeSpecifier getMessageTypeSpecifier()

Return Value

The qualified message type of this request.

getCorrelationId

global String getCorrelationId()

Return Value

The correlation Id associated with this request.

getBody

global virtual String getBody()

Return Value

The message body associated with this request.

equals

global Boolean equals(Object obj)

This compares all the values between the method caller and the object provided. This ensures that the two objects are of the same type and that all the data on the object is identical.

Input Parameters

Name Type Description
obj Object The object we want to compare against.

hashcode

global Integer hashcode()

Return Value

A hashcode based on all the information on the object.

fferpcore.MessagingSystemService.DeliverNowResult

global inherited sharing class DeliverNowResult

A result which contains the results of the messages sent.

Methods

DeliverNowResult

global DeliverNowResult()

Default constructor provided to support legacy test code in client software.

DeliverNowResult

global DeliverNowResult(List<fferpcore.MessagingSystemService.SynchronousMessageResult> results)

Constructs a DeliverNowResult.

Input Parameters

Name Type Description
results List<fferpcore.MessagingSystemService.SynchronousMessageResult> Delivery results for each message request.

getResultsByCorrelation

global Map<String, fferpcore.MessagingSystemService.SynchronousMessageResult> getResultsByCorrelation()

Return Value

The delivery results for each message keyed on correlation ID.

fferpcore.MessagingSystemService.SynchronousMessageResult

global interface SynchronousMessageResult

The result of a deliver now request for a message.

Methods

getCorrelationId

String getCorrelationId()

Return Value

The correlation ID used for the message.

getRecipientCount

Integer getRecipientCount()

Return Value

The number of recipients of the message. This count includes successful deliveries, errors and deferred.

getErrorCount

Integer getErrorCount()

Return Value

The number of recipients that reported an error.

getDeferredCount

Integer getDeferredCount()

Return Value

The number of deliveries that have been deferred. This count includes messages delivered by a batch process and by the capturing scope mechanism.

fferpcore.MessagingSystemService.DeliverLaterResult

global inherited sharing class DeliverLaterResult

A currently empty result allows us to add result information later while keeping within Salesforce's upgrade restrictions.

fferpcore.MessagingSystemService.Sender

global inherited sharing class Sender

A class that wraps up information about who is sending the message. It combines a Product and a ProductProxy.

Methods

Sender

global Sender(String productDeveloperName)

Creates a Sender for the specified product and the Managed Product Proxy. This method is a convenience for calling MessagingSystemService.Sender(product, ProductProxies.MANAGED_PROXY_DEVELOPER_NAME).

Input Parameters

Name Type Description
productDeveloperName String The developerName of the Product we are sending from.

Sender

global Sender(String productDeveloperName, String productProxyDeveloperName)

Creates a Sender from the specified product and proxy.

Input Parameters

Name Type Description
productDeveloperName String The developerName of the Product we are sending from.
productProxyDeveloperName String The developerName of the ProductProxy we are sending from.

withForceSend

global fferpcore.MessagingSystemService.Sender withForceSend(Boolean forceSend)

Specifies whether this sender ignores the process builder scope and flag.

Input Parameters

Name Type Description
forceSend Boolean True if yes, false otherwise.

Return Value

The Sender instance. This enables further methods to be invoked.

getProductDeveloperName

global String getProductDeveloperName()

Return Value

Returns the developerName of the Product.

getProductProxyDeveloperName

global String getProductProxyDeveloperName()

Return Value

The developerName of the proxy that the product is sending on behalf of.

getForceSend

global Boolean getForceSend()

Return Value

A boolean value that indicates whether this sender ignores the process builder scope and flag.

fferpcore.MessagingSystemService.MessageTypeSpecifier

global inherited sharing class MessageTypeSpecifier

A class that contains information about the type of message sent in a particular request. It contains the message type, and also a identifier. A product/proxy can have different publications for the same message type if they have different identifiers. This class is used to identify the publication a product/proxy wishes to send on.

Methods

MessageTypeSpecifier

global MessageTypeSpecifier(String messageTypeDeveloperName, String identifier)

Creates a MessageTypeSpecifier from the supplied MessageType and Identifier

Input Parameters

Name Type Description
messageTypeDeveloperName String The developerName of a messageType.
identifier String A string that provides extra information to identify the publication we wish to use.

MessageTypeSpecifier

global MessageTypeSpecifier(String messageTypeDeveloperName)

Creates a MessageTypeSpecifier from the supplied MessageType and no Identifier

Input Parameters

Name Type Description
messageTypeDeveloperName String The developerName of a messageType.

getMessageTypeDeveloperName

global String getMessageTypeDeveloperName()

Return Value

The developerName of the messageType.

getIdentifier

global String getIdentifier()

Return Value

The identifier used when this object was constructed.

© Copyright 2009–2024 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.