integration: how it’s done · system integration is easy, right? not quite… each system...

35
Integration: How It’s Done Let’s Integrate Acumatica with the World! Sergey Marenich Commerce Edition Architect & Team Lead

Upload: others

Post on 20-Jul-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

Integration: How It’s DoneLet’s Integrate Acumatica with the World!

Sergey Marenich

Commerce Edition Architect & Team Lead

Page 2: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

2

Marenich Sergey

13 years of experience at Acumatica

• Build Engineer

• System Developer

• Product Engineer

• Solution Architect

• Team Lead

• Commerce Edition Architect

@: [email protected]

P: Commerce Edition Architect & Team Lead

U: http://asiablog.acumatica.com

Page 3: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

3

Integration: Is there something unsaid yet?

Page 4: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

4

Page 5: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

5

Plug & Play

Develop Fast

Low Cost

What Clients Want from “Integration”?

Reliable & Consistency

Notifications on Issues

Ability to Solve Problems

Choose what to Sync

Adjust Workflow

Conflict Resolution

Close to Realtime

Run Fast

Page 6: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

6

Each system supports

own version cycle

which significantly

increases the

complicity of

integration project

with any addition

system

Integration is Easy, Right? Not Quite…

Each system designed

in the different ways

and approaches.

This leads to

challenges with:

• Data flow

• Data mapping

• Actions calling

• Custom fields

handling

Data Structures &

Business

Logic

Versions Hell

Each system protects

own resources and

applies license.

As a result integration

suffers from very

different limit of

resources.

API Limits &

Throttling

Each system relies on

different technologies

and even changes in a

while:

• REST

• Graph QL

• SOAP

• gRPC

• JSON-RPC

• Thrift

API Technology

Evolution

Page 7: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

7

Page 8: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

8

Integration Platforms – Solution?

Complexity of implementation is shifted from developer to the engineer through configurationsComplicated

Development and Code Maintenance effort of API clients is still requiredAPI Clients

Applying of the same use-case to multiple clients requires special deployment proceduresProductizing

Upgrade requires abstraction level between core integration and customer specific customizationUpgrade

Complicated systems like ERP with designed business flow (Order-Shipment-Invoice) adds extra complexity

Business Logic Flow

Page 9: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

9

Idea: Acumatica Commerce Edition

Page 10: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

10

Commerce Enabled ERP – Vision

BigCommerce

Connector

Shopify

Connector

Amazon

Connector

Connector

Foundation

Customers

External Systems Acumatica

Products

Stock Levels

Prices

Taxes

Orders

Shipments

Payments

Discounts

POS Connector

Page 11: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

11

Commerce Enabled ERP – System Requirements

Plugin-like Architecture with the same Infrastructure

Interaction Abstraction on Acumatica Screens

Processing Queue to Spread out Peaks Load

Parallel Processing of the Queue

Push and Scheduled Synchronization

User Defined Fields Mapping (with Formulas)

User Define Conditions (Filters) for Synchronization

Synchronization Algorithm, Status and Conflict Resolutions

Tools: Logging, Monitoring, Issue Handling

Duplicates Merge

Specialized API Endpoints: Taxes, Availability, CC Tokens

Page 12: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

12

Plugin-like Architecture

Page 13: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

13

Screens

Connector Architecture

Big

Co

mm

erc

e

Co

nn

ecto

r

Big

Com

me

rce

External Systems

Sh

op

ify

Customers

Products

Orders

Customers

Products

Orders

Sh

op

ify

Co

nn

ecto

r

Acumatica

Connection &

Default SettingsCustomers Processor

Products Processor

Orders Processor

Customers Processor

Products Processor

Orders ProcessorAcumatica

Customers

Products

Orders

Mapping &

Filtering

Prepare Data

Process Data

Status Data

Monitoring

SharedPlugins

Connector

Page 14: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

14

Abstraction on Acumatica Screens

Page 15: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

15

Saving Data to Acumatica

Direct to Database

• Pros

• Very Fast

• No need to learn BQL

• Cons

• Need to know SQL

• Bypassing business logic

• High change to make a mistake

• Affected by upgrades

• Does not work on SaaS

Graph Program API

• Pros

• Fast

• Flexible

• Cons

• Need to learn BQL and Event Model

• Logic requires emulation of user interface

• Affected by Upgrades

Import Scenarios with Data Provider

• Pros

• User configurable mapping

• Great business logic abstraction

• No need to learn BQL

• Less code needed

• Cons

• Hard to implement data flow

• Hard to do data queries

• Hard to run in parallel

• Hard to upgrade

Contract Base API

• Pros

• Contracts are protected from upgrades

• Great business logic abstraction

• No need to learn BQL

• Easy Data Queries

• Easy Parallel Processing

• Endpoint is an extension point

• Documentation

• Cons

• API Calls Limits

Page 16: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

16

CB API Adaptor

Read/Save Abstraction

External

System

External

API

Adapter

CB API

Engine

REST API

Get

Screens

Graphs

DACs

Put

Processor

Invoke

GetList

External Systems AcumaticaConnector

xPort Engine

Page 17: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

17

Processing Queues with Parallel Processing

Page 18: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

18

Processing Queues

Queues help us to:

• Withstand the load

• Spread Peaks

• Splitting of fetching and saving logic

• Dedicated Processing Node

External

SystemAcumatica

Web Hook

Handler

Push

Notification

Destination

MSMQ

(Fast Queue)

DB Table

(Slow Queue)Triggered

Fetch

Triggered

Fetch

Parallel Processing / Processing Server

Connector

Page 19: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

19

Handling of Real-Time Sync

Webhook Handler Push Notification Destination

Page 20: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

20

Filtering & Mapping

Page 21: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

21

Filtering & Mapping

External

SystemAcumatica

API Client

Mapping

Engine

Connector

REST Classes CB Classes

API Client

Customer

Product

Order

Customer

Product

Order

Processor

ORM ORMReflection

Filtering

Engine

Page 22: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

22

Synchronization Algorithm and Status

Page 23: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

23

Synchronization Algorithm and StatuseC

om

merc

e

Acum

atica

Push Notifications Engine

E-Com

API

Adaptor

AC API

Adaptor

Web HookPush Notifications

Subscriber

Events

Busin

ess

Events

MSMQ

Queue

Processor

Connector Plugins

Sync Status Table

Get

Put

Get

Put

Local ID Extern ID

Local TS Extern TS

Customer Processor

Push Push

Update Status

Scheduled Fetch

Full / Incremental

Pending

Sync

Scheduled Fetch

Full / Incremental

Pickup

Records

with

Pending

Sync

• Dispatch Message

• Pull Record Details

• Filter Record

• Update Sync Status

• Get Acumatica Entity with API

• Get eCommerce Entity with API

• Define sync direction

• If new – check for duplicates

• If existing – check timestamps

• If conflict – use primary system

• Map Source to Destination

• Save Record to Destination

• Update Timestamps and IDsOrder

Processor

Processors

Connector FoundationMapping Logging Configurations

ExportImport

Start Sync

Pro

ducts

Custo

mers

Ord

ers

Custo

mers

Invento

ryO

rders

Page 24: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

24

Synchronization Status

Identity, Primary KeySync ID

Current Status of the record: Synchronized, Pending, Failed, Skipped, Deleted, …Status

Note ID from Acumatica. Starting from Acumatica 2019R2 you can use Note ID as permanent Key for API Calls.Local ID

Date & Time when record was Last Modified at AcumaticaLocal Time Stamp

ID of the record from External System External ID

Date & Time when record was Last Modified at External SystemExternal Time Stamp

Last Synchronization Error if record is in Failed StatusLast Error

Page 25: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

25

Synchronization Algorithm

Operation Status LocalID LocalTS ExtenID ExternTS

1New Customer created Externally

at 1:23PM 1/1/2020Pending 1

1:23PM

1/1/2020

2Synchronization of Customer

at 1:31PM 1/1/2020Synced

5819C47C-

1DCC-…

1:31PM

1/1/20201

1:23PM

1/1/2020

3Customer has Updated Locally

At 1:44PM 1/1/2020Pending

5819C47C-

1DCC-…

1:31PM

1/1/20201

1:23PM

1/1/2020

4Synchronization of Customer

at 1:49PM 1/1/2020Synced

5819C47C-

1DCC-…

1:44PM

1/1/20201

1:49PM

1/1/2020

5Customer has Updated Externally

At 2:01PM 1/1/2020Pending

5819C47C-

1DCC-…

1:44PM

1/1/20201

1:49PM

1/1/2020

6Customer has Updated Locally

At 2:07PM 1/1/2020Pending

5819C47C-

1DCC-…

1:44PM

1/1/20201

1:49PM

1/1/2020

7

Synchronization of Customer in favor

of Primary System at 2:10PM

1/1/2020

Synced5819C47C-

1DCC-…

2:10PM

1/1/20201

2:07PM

1/1/2020

Page 26: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

26

Synchronization Algorithm

Save Changes

• Update Time Stamps

Map Data

• External to Local or Local to External Depend on Direction

• Apply User Mapping

Define Direction

• Compare Time Stamps and define what record has changed since last time

• In case of conflict solve in favor for primary system

Check for Duplicates

• Only if record is new, try to merge by ID

Get

• Get Object from Local System

• Get Object from External System

• Apply Filtering Conditions

Page 27: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

27

Development

Page 28: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

28

Implementing of New Connector

• <Connector> : IConnector

• PXGraph

• Connection Settings

• Navigation to Records

• Realtime Subscription &

Processing

• Sync Processing

• <Processors> : IProcessor

• PXGraph

• Fetching of Records

• Getting of Local and External

Records

• Default Mapping Logic

• Export and Import Logic

• Sync Processing

• Libraries:

• PX.Commerce.Core

• PX.Commerce.Objects

Page 29: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

29

Implementing of New Processor

Description Import Export

Fetch changed records

Update BCSyncStatus

void GetBucketsForImport(DateTime? lastModifiedDateTime, PXFilterRow[] filters)

void GetBucketsForExport(DateTime? lastModifiedDateTime, PXFilterRow[] filters)

Get entity (with all details)

bool GetBucketForImport(BCSalesOrderBucket bucket, BCSyncStatus syncstatus)

bool GetBucketForExport(BCSalesOrderBucket bucket, BCSyncStatus syncstatus)

Map single entity between

systems

void MapBucketImport(BCSalesOrderBucket bucket, IMappedEntity existing)

void MapBucketImport(BCSalesOrderBucket bucket, IMappedEntity existing)

Save entity to destination system

(with all details)

void SaveBucketImport(BCSalesOrderBucket bucket, IMappedEntity existing, String operation)

void SaveBucketImport(BCSalesOrderBucket bucket, IMappedEntity existing, String operation)

Pull primary entity only.

For push notificaitons

MappedOrder PullEntity(String externID, String jsonObject)

MappedOrder PullEntity(Guid? localID, Dictionary<String, Object> fields)

Page 30: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

30

Summary

Page 31: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

31

Acumatica Integration - Expectations

Framework

Requires Coding: API Clients, Mapping, Logic

Experimental Model

Commerce focused (Shipping Cards, POS)

Documentation is in the Roadmap

Time to Complete

Page 32: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

32

Code Example – Trello Connector

Git Hub Project: https://github.com/smarenich/TrelloConnector

Simplifications:

• API URLs Hardcoded

• API Credentials Hardcoded

• Only Cards Import (No boards, No lists)

• No Push Notifications

Page 33: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

33

Fall 2020

Page 34: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

34

Open Architecture and Rapid Integration

Page 35: Integration: How It’s Done · system Integration is Easy, Right? Not Quite… Each system designed in the different ways and approaches. This leads to challenges with: • Data

Thank You!

Sergey Marenich

[email protected]