---
schema_version: "1"
id: dab25f417c7bfea50e4a3a7748ca2c42656448f1346f0dded2ff11a9276635ea
title: PlatformEventSubscriberConfig
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_platformeventsubscriberconfig.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_platformeventsubscriberconfig.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 02c24b9cb4600506e3fce1b8203543e0d5c6af7586f8655f606edbd883f169b2
description: Represents configuration settings for a platform event Apex trigger, including the batch size and the trigger’s running user.
---
# PlatformEventSubscriberConfig

Represents configuration settings for a platform event Apex trigger, including the batch size and the trigger’s running user.

This type extends the [Metadata](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/metadata.htm "The base class for all metadata types. You can’t edit this object. A component is an instance of a metadata type.") metadata type and inherits its fullName field.

![Important](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/images/icon_note_important.png)

#### Important

Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations.

## File Suffix and Directory Location

PlatformEventSubscriberConfig components have the suffix .platformEventSubscriberConfig and are stored in the PlatformEventSubscriberConfigs folder.

## Version

PlatformEventSubscriberConfig components are available in API version 51.0 and later.

## Fields

<table class="featureTable sort_table" summary="">



          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d752785e102">Field Name</th>

              <th class="featureTableHeader  " id="d752785e105">Field Type</th>

              <th class="featureTableHeader  " id="d752785e108">Description</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d752785e102" data-title="Field Name"><span class="keyword parmname">batchSize</span></td>

              <td class="entry" headers="d752785e105" data-title="Field Type">int</td>

              <td class="entry" headers="d752785e108" data-title="Description">A custom batch size, from 1 through 2,000, for the platform event Apex trigger.
                The batch size corresponds to the maximum number of event messages that can be sent
                to a trigger in one execution. The default batch size is 2,000 for platform event
                triggers. <p class="p">We don't recommend setting the batch size to 1 to process one event at
                  a time. Small batch sizes can slow down the processing of event
                  messages.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d752785e102" data-title="Field Name"><span class="keyword parmname">isProtected</span></td>

              <td class="entry" headers="d752785e105" data-title="Field Type">boolean</td>

              <td class="entry" headers="d752785e108" data-title="Description">(Inherited
                field.) Indicates whether this component is protected (<samp class="codeph nolang">true</samp>) or not (<samp class="codeph nolang">false</samp>). Protected
                components can’t be linked to or referenced by components created in a subscriber
                org. A developer can delete a protected component in a future release without
                worrying about failing installations. However, once a component is marked as
                unprotected and is released globally, the developer can’t delete it.</td>

            </tr>

            <tr>
              <td class="entry" headers="d752785e102" data-title="Field Name"><span class="keyword parmname">masterLabel</span></td>

              <td class="entry" headers="d752785e105" data-title="Field Type">string</td>

              <td class="entry" headers="d752785e108" data-title="Description">Required. The label for the PlatformEventSubscriberConfig component.</td>

            </tr>

            <tr>
              <td class="entry" headers="d752785e102" data-title="Field Name"><span class="keyword parmname">numPartitions</span></td>

              <td class="entry" headers="d752785e105" data-title="Field Type">int</td>

              <td class="entry" headers="d752785e108" data-title="Description">Specifies the number of parallel subscriptions, or partitions, that are created
                internally for an Apex trigger. Use this field to set up parallel subscriptions for
                the platform event Apex trigger. It can be an integer from 1 through 10. See <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.264.0.platform_events.meta/platform_events/platform_events_ps.htm" target="_blank">Platform Event Processing at
                  Scale with Parallel Subscriptions for Apex Triggers</a> in the <cite class="cite">Platform
                  Events Developer Guide</cite>.<p class="p">The default value is 1. This field is available
                  in API version 62.0 and later.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d752785e102" data-title="Field Name"><span class="keyword parmname">partitionKey</span></td>

              <td class="entry" headers="d752785e105" data-title="Field Type">string</td>

              <td class="entry" headers="d752785e108" data-title="Description">Can be the standard <samp class="codeph nolang">EventUuid</samp> field or a
                required custom field of the custom platform event that the Apex trigger subscribes
                to. For the standard <span class="keyword parmname">EventUuid</span> field, the partition key format
                is the field name without the event name: <samp class="codeph nolang">EventUuid</samp>. For a custom field, the partition key includes the event
                name as a prefix in this format: <samp class="codeph nolang"><var class="keyword varname">EventName__e</var>.<var class="keyword varname">FieldName__c</var></samp>. Based
                on the field’s generated hash value, the system determines which partition to send
                the event to. Use this field to specify the platform event field that is used as a
                partition key for parallel subscriptions. See <a class="xref" href="https://developer.salesforce.com/docs/atlas.en-us.264.0.platform_events.meta/platform_events/platform_events_ps.htm" target="_blank">Platform Event Processing at Scale with Parallel
                  Subscriptions for Apex Triggers</a> in the <cite class="cite">Platform Events Developer
                  Guide</cite>.<p class="p">The default value is <samp class="codeph nolang">EventUuid</samp>. This field is available in API version 62.0 and
                  later.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d752785e102" data-title="Field Name"><span class="keyword parmname">platformEventConsumer</span></td>

              <td class="entry" headers="d752785e105" data-title="Field Type">string</td>

              <td class="entry" headers="d752785e108" data-title="Description">Required. The full name of the platform event Apex trigger to
                configure.</td>

            </tr>

            <tr>
              <td class="entry" headers="d752785e102" data-title="Field Name"><span class="keyword parmname">user</span></td>

              <td class="entry" headers="d752785e105" data-title="Field Type">string</td>

              <td class="entry" headers="d752785e108" data-title="Description">The username of the user that the platform event Apex trigger runs as. By
                default, the platform event trigger runs as the Automated Process entity. Setting
                the running user to a specific user has these benefits:<ul class="ul bulletList">
                  <li class="li">Records are created or modified as this user.</li>

                  <li class="li">Records with <span class="keyword parmname">OwnerId</span> fields have their
                    <span class="keyword parmname">OwnerId</span> fields populated to this user when created or
                    modified.
                  </li>

                  <li class="li">Debug logs for the trigger execution are created by this user.</li>

                  <li class="li">You can send email from the trigger, which isn’t supported with the default
                    Automated Process user.</li>

                </ul>
              </td>

            </tr>

          </tbody>

        </table>

## Declarative Metadata Sample Definition

This PlatformEventSubscriberConfig component has the label OrderEventTriggerConfig. It contains the configuration of a platform event trigger, OrderEventTrigger, and specifies the batch size and user.

<?xml version="1.0" encoding="UTF-8"?>
<PlatformEventSubscriberConfig xmlns="http://soap.sforce.com/2006/04/metadata">
    <platformEventConsumer\>OrderEventTrigger</platformEventConsumer\>
    <batchSize\>200</batchSize\>
    <masterLabel\>OrderEventTriggerConfig</masterLabel\>
    <user\>user@example.com</user\>
    <isProtected\>false</isProtected\>
</PlatformEventSubscriberConfig\>

PlatformEventSubscriberConfig references an Apex trigger, which depends on a platform event. If the referenced items exist in the Salesforce org, you can deploy the PlatformEventSubscriberConfig component. This package.xml specifies the PlatformEventSubscriberConfig component.

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types\>
        <name\>PlatformEventSubscriberConfig</name\>
        <members\>OrderEventTriggerConfig</members\>
    </types\>
    <version\>68.0</version\>
</Package\>

If the referenced trigger and platform event don’t exist in the org, include their definitions in the package. Otherwise, the deployment fails. This example package.xml includes all the referenced components.

- CustomObject represents the platform event.
- CustomField represents a custom field defined on the platform event.
- ApexTrigger represents the platform event trigger.
- PlatformEventSubscriberConfig represents the configuration options for the platform event trigger.

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types\>
        <name\>CustomObject</name\>
        <members\>PlatformEvent\_\_e</members\>
    </types\>
    <types\>
        <name\>CustomField</name\>
        <members\>PlatformEvent\_\_e.Message\_\_c</members\>
    </types\>
    <types\>
        <name\>ApexTrigger</name\>
        <members\>OrderEventTrigger</members\>
    </types\>
    <types\>
        <name\>PlatformEventSubscriberConfig</name\>
        <members\>OrderEventTriggerConfig</members\>
    </types\>
    <version\>68.0</version\>
</Package\>

To specify all PlatformEventSubscriberConfig components, use the wildcard character, as shown in this example.

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types\>
        <name\>PlatformEventSubscriberConfig</name\>
        <members\>\*</members\>
    </types\>
    <version\>68.0</version\>
</Package\>

## Wildcard Support in the Manifest File

This metadata type supports the wildcard character \* (asterisk) in the package.xml manifest file. For information about using the manifest file, see [Deploying and Retrieving Metadata with the Zip File](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/file_based_zip_file.htm "The deploy() and retrieve() calls are used to deploy and retrieve a .zip file. Within the .zip file is a project manifest (package.xml) that lists what to retrieve or deploy, and one or more XML components that are organized into folders.").