Step 2: Supporting Push Notifications in the Connector

For the entities for which you need to support real-time export through push notifications, you need to adjust the processor classes that correspond to these entities so that the processor classes support real-time synchronization. For details about processor classes, see Processor Classes. For information about the implementation of processor classes, see Step 8: Implementing the Processor Classes of To Create a Connector for an External System.

Supporting Real-Time Export in the Connector

  1. For each processor class that needs to support real-time export through push notifications, make sure that the processor class supports the export of records from MYOB Advanced by checking the following requirements:
    • The BCProcessor attribute of the processor has the Direction property set to SyncDirection.Bidirect or SyncDirection.Export.
    • The FetchBucketsForExport(), GetBucketForExport(), MapBucketExport(), SaveBucketExport(), and PullEntity() methods of the processor have been implemented. An example of the implementation of the PullEntity() method is shown in the following code.
      public override async Task<MappedCustomer> PullEntity(Guid? localID, 
          Dictionary<string, object> externalInfo, 
          CancellationToken cancellationToken = default)
      {
          PX.Commerce.Core.API.Customer impl = cbapi.GetByID<PX.Commerce.Core.API.Customer>(localID);
          if (impl == null) return null;
      
          MappedCustomer obj = new MappedCustomer(impl, impl.SyncID, impl.SyncTime);
      
          return obj;
      }
  2. For each processor class that needs to support real-time synchronization through push notifications, modify the BCProcessorRealtime attribute of the processor so that it has the PushSupported property set to true. In the PushSources property specify the names of the generic inquiries to be used for push notifications. In the PushDestination property, specify the name of the push notification destination, which is Commerce if you use the predefined notification destination.

    The following code shows an example of the attribute for the customer processor class.

    ...
    [BCProcessorRealtime(PushSupported = true, HookSupported = false,
      PushSources = new String[] { "BC-PUSH-Customers" },
      PushDestination = WCCaptions.PushDestination
    )]
    public class WooCustomerProcessor : BCProcessorSingleBase<WooCustomerProcessor, 
      WooCustomerEntityBucket, MappedCustomer>, IProcessor
    {
      ...
    }
  3. Build the project of the extension library.