[WORK IN PROGRESS] - SalesforceBundle
(Yet another) Salesforce synchronization tool, using a RabbitMQ engine to defer and bulk synchronization.
Using Streaming API to fetch back records from Salesforce., (*1)
Installation
Require the bundle:, (*2)
composer require swisscat/salesforce-bundle
Register the bundle:, (*3)
// app/AppKernel.php
public function registerBundles()
{
$bundles = [
// ... ,
new \OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(),
new \Swisscat\SalesforceBundle\SalesforceBundle(),
];
}
Generate a Salesforce Enterprise WSDL, (*4)
Fill in basic config, (*5)
salesforce:
soap_client:
wsdl: "%kernel.root_dir%/config/sf.wsdl"
username: <username>
password: <password>
token: <token>
Update schema:, (*6)
bin/console doctrine:migrations:diff
bin/console doctrine:migrations:migrate
Configuration
Edit config.yml, (*7)
salesforce:
soap_client:
wsdl: "%kernel.root_dir%/config/sf.wsdl"
username: <username>
password: <password>
token: <token>
old_sound_rabbit_mq:
connections:
default:
host: 'localhost'
port: 5672
user: 'guest'
password: 'guest'
vhost: '/'
lazy: true
connection_timeout: 60
keepalive: true
use_socket: false # default false
producers:
sync_salesforce:
connection: default
exchange_options: {name: 'sync-salesforce', type: direct}
service_alias: sync_salesforce # no alias by default
consumers:
salesforce_back:
connection: default
exchange_options: {name: 'salesforce', type: direct}
queue_options: {name: 'salesforce'}
callback: sylius.consumer.salesforce_back
batch_consumers:
sync_salesforce:
connection: default
exchange_options: {name: 'sync-salesforce', type: direct}
queue_options: {name: 'sync-salesforce'}
callback: sylius.consumer.salesforce
qos_options: {prefetch_size: 0, prefetch_count: 2, global: false}
Run the command to process records, (*8)
bin/console rabbitmq:batch:consumer sync_salesforce
Run the command to fetch Topic Updates (See https://github.com/swisscat/salesforce-amqp-connector), (*9)
bin/console rabbitmq:consumer salesforce_back
Roadmap
- [ ] Refactor / cleanup
- [ ] Complete tests
- [ ] Improve RabbitMQ exchange configuration
- [ ] Provide queue configurability on ecommerce
- [ ] Handle failures on ecommerce publish
- [ ] Generalize bundle for other providers (i.e magento)
- [ ] Authentication with Token for Java API
- [ ] Implement bundle logic for reconciliation (Master: SF/ECOM/storing conflicts)
- [ ] Improve mapping definition (custom functions)
- [ ] Implement mapping associations (entity relations)