Saturday, September 23, 2023
HomeUncategorizedConfigure the Batch Measurement for Platform Occasion Set off

Configure the Batch Measurement for Platform Occasion Set off

[ad_1]

Final Up to date on April 30, 2023 by Rakesh Gupta

Large Thought or Enduring Query:

  • The way to configure the person and batch dimension for Platform Occasion Set off?

Targets:

After studying this weblog, you’ll be capable to:

  • Perceive the batch dimension for platform occasion set off
  • Override the default working person for platform occasion set off
  • Create the PlatformEventSubscriberConfig through REST API
  • and rather more

Jestilla Zetkin is working as a Salesforce Architect at Gurukul On Cloud (GoC). Just lately she confronted challenges whereas working with platform occasions, primarily governer limits. She desires to learn to configure the batch dimension for the platform occasion set off. On this train, we are going to arrange the batch dimension for the next:

  1. Apex Set off 
    1. LeadGenerationEventTrigger on Lead_Generation__e 
    2. Batch Measurement: 50
    3. Working Person: Integration Person

What’s Platform Occasions?

Occasion-driven architectures have develop into highly regarded in recent times, and for an excellent cause. It’s based mostly on the fire-and-forget sample. Firing an occasion and letting every system deal with enterprise logic means that you can hold unrelated programs decoupled and will help simplify the structure.

Platform occasions allow you to ship safe, scalable, and customizable occasion notifications inside Salesforce or from exterior sources. Apps can publish and subscribe to Platform Occasions on the Salesforce platform utilizing Apex, Circulation, or in an exterior system utilizing CometD. If you wish to study extra about Platform Occasion, try the Trailhead Module.

What’s the Default Batch Measurement for Platform Occasion Set off?

By default, the platform occasion set off runs because the Automated Course of system person with a batch dimension of two,000 occasion messages. Typically it’s required to vary the person and batch dimension to bypass governer limits or different challenges.

Salesforce means that you can override the default working person and batch dimension of a platform occasion Apex set off with PlatformEventSubscriberConfig in Tooling API or Metadata API to configure the set off.

You may specify any energetic person within the Salesforce org. The set off runs in a system context with privileges to entry all information whatever the person’s object and field-level permissions. You may specify a customized batch dimension from 1 via 2,000. The batch dimension is the utmost variety of occasion messages that may be despatched to a set off in a single execution.

Perceive PlatformEventSubscriberConfig Object

Let’s take a pause right here, familiarize your self with the PlatformEventUsageMetric Tooling API object in Salesforce. It represents configuration settings for a platform occasion Apex set off, together with the batch dimension and the set off’s working person.

Subject Title
Particulars
BatchSize A customized batch dimension, from 1 via 2,000, for the platform occasion Apex set off. The batch dimension corresponds to the utmost variety of occasion messages that may be despatched to a set off in a single execution. The default batch dimension is 2,000 for platform occasion triggers.
DeveloperName The distinctive title for the PlatformEventSubscriberConfig object.
MasterLabel Label for PlatformEventSubscriberConfig. Within the UI, this area is Platform Occasion Subscriber Configuration.
PlatformEventConsumerId The ID of the platform occasion Apex set off to configure.
UserId The ID of the person that the platform occasion Apex set off runs as. By default, the platform occasion set off runs because the Automated Course of entity. Setting the working person to a particular person has these advantages:

  • Data are created or modified as this person.
  • Data with OwnerId fields have their OwnerId fields populated to this person when created or modified.
  • Debug logs for the set off execution are created by this person.
  • You may ship e mail from the set off, which isn’t supported with the default Automated Course of person.

PlatformEventSubscriberConfig elements have the suffix .platformEventSubscriberConfig and are saved within the PlatformEventSubscriberConfigs folder.

This PlatformEventSubscriberConfig element has the label LeadGenerationEventTriggerConfig. It incorporates the configuration of a platform occasion set off, LeadGenerationTrigger, and specifies the batch dimension and person.


<?xml model="1.0" encoding="UTF-8"?>
<PlatformEventSubscriberConfig xmlns="http://cleaning soap.sforce.com/2006/04/metadata">
    <platformEventConsumer>LeadGenerationTrigger</platformEventConsumer>
    <batchSize>50</batchSize>
    <masterLabel>LeadGenerationEventTriggerConfig</masterLabel>
    <person>developer@automationchampion.com</person>
    <isProtected>false</isProtected>
</PlatformEventSubscriberConfig>

Guided Apply (We-do):

So as to add a configuration, carry out a POST request as talked about under:

  1. Open the Workbench and log in along with your Trailhead playground username and password.
  2. Just remember to’ve chosen the Manufacturing for Atmosphere possibility.
  3. Navigate to Utilities tab and choose the REST Explorer possibility.
  4. Choose the next choices:
    1. Select an HTTP methodology to carry out on the REST API service URI under: POST
    2. URL: /companies/knowledge/v58.0/tooling/sobjects/PlatformEventSubscriberConfig
    3. Physique: Present the values within the request physique. This instance request configures an current set off with the batch dimension of 50 and specifies the ID of a working person.
      1. {
        “BatchSize”: “50”,
        “DeveloperName”:”LeadGenerationEventTriggerConfig”,
        “MasterLabel”:”LeadGenerationEventTriggerConfig”,
        “PlatformEventConsumerId”: “01qB0000000Zcug”,
        “UserId”: “005B00000015gt8”
        }
      2. The place:
        1. 01qB0000000Zcug, Apex set off on Lead_Generation__e
        2. 005B00000015gt8, is person Id of Integration Person
    4. Click on Execute.
  5. You may question retrieve the configurations in your org with SOQL. If querying from the Developer Console Question Editor, guarantee you choose Use Tooling API. This instance question retrieves all configurations arrange in your Salesforce org.

Formative Evaluation:

I need to hear from you!

What’s one factor you realized from this publish? How do you envision making use of this new information in the true world? Be at liberty to share within the feedback under.

[ad_2]

Source link

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

Recent Comments