As NYC Modern Taxi begins its quest to compete with ride sharing companies, it faces many challenges. One of them is winning over existing taxi drivers, who aren't excited about using the new app.

To that end, NYC Modern Taxi Company decided to use Salesforce to treat each cabdriver like a potential customer. Account managers have been assigned 30 taxicab drivers each and have been instructed to spare no amount of free coffee to get them using the new app. Time is of the essence, so as soon as a driver agrees to join the app, the data in Salesforce needs to be available in the operations database. Simultaneously, NYC Taxi conducts a background check.

In this scenario, there's no time for data re-entry, or delays in data transmission: It's gotta be event-driven. If a driver tries to login to the app and can't because the information isn't there...fuhgettaboutit.

This codelab covers a lot of ground. You'll learn about:

✅ How to design an Event Driven Architecture with the Solace's Event Portal

✅ How to seamlessly implement your architecture using the PubSub+ Connector for Boomi and distribute real-time data around your enterprise

✅ How to get events flowing out of Salesforce using its Change Data Capture and Platform Events capabilities

✅ How to use Boomi's Salesforce Platform Events connector to receive those events and transform them

✅ How to interact with Azure SQL, a cloud-based database, using Boomi's connector.

  1. A general understanding of event-driven architecture (EDA) terms and concepts.
  2. Basic knowledge of the Boomi GUI and deployments. A good place to start would be the Getting Started with Boomi and Solace Codelab.
  3. A free Salesforce developer account. You can sign up here: https://developer.salesforce.com/signup
  4. A free Azure account: You can sign up here: https://azure.microsoft.com/en-us/free/

After you finish the Getting Started with Boomi and Solace codelab, you'll have the following

⚙️ Import Event Portal Application Domain

Download the Event Portal Application Domain export files:

Back Office

Analytics

Operations

Inside of your logged into Solace Cloud Account navigate to the Event Portal Designer by clicking "Designer" in the menu on the left.

event

Then import the downloaded Application Domain files by clicking the Import button at the top right of the Designer and importing the files.

ep_click_import

⚙️ High-level Architecture overview with the Solace Event Portal

  1. Go to the Solace Event Portal Designer https://console.solace.cloud/designer
  2. Open the NYC Modern Taxi Co – Back Office domain by double clicking on it.

eventportaldomain

Here's the basic flow of events through the system

👉 After being convinced by cash, coffee or other means, a driver agrees to use the app

👉 The account representative changes the driver's account from inactive to active

👉 Salesforce sends an event to Boomi

👉 A Boomi process transforms the event payload, removing unnecessary fields and publishes the event to the Solace event broker.

👉 Solace simultaneously distributes copies of the driver's information across the company:

Do a deep dive into the individual applications, events and schemas by double clicking on them. Note that Event Portal houses all the schemas and topic strings that you'll need for the CodeLab.

Two notes:

⚙️ Deeper Dive into Salesforce Event Architecture

sf_arch

⚙️ Get connection values for PubSub+

Follow the steps in the Getting Started with Boomi and Solace codelab to get the connection values for your Solace PubSub+ Broker

⚙️ Generate the Solace Event Portal token

  1. You'll generate the token needed to connect to the Event Portal from Boomi. Click on the very last icon in the left hand column takes you to the User Profile (the label will be your account name, not Solace CTO 😄) Note: if you've already generated an Event Portal token for another CodeLab, feel free to reuse it. image007
  2. Click on Token Management image008
  3. Click on Create Token image009
  4. Name the token BoomiUIAccess. Give it the "Event Portal Read" permission: image010
  5. Click on Generate Token image011
  6. Copy the generated token to a text editor. You will use it in the next section.

⚙️ Boomi configuration

⚙️ Connect the process to listen for Solace events

  1. Go to the Boomi Integrate UI
  2. Open the Hello World – Listen for Solace Event process you just added to your workspace. image013
  3. Click on the start shape, then click on the pencil icon next to the Solace Event Portal and PubSub+ Connection field image014
  4. Fill in the Solace Event Portal and Event Broker connection information you gathered in the last section. image015
  5. Click on Test Connection. Select an atom, then click Next. You should get a message indicating that the test connection was successful. Then save and close the Connection. image016
  6. Next, modify the Connector Operation by clicking on the pencil icon. image017
  7. Click on the Import button image018
  8. Pick an atom, and use the Event Portal connection that you just modified. image019
  9. Event Portal returns a list of events currently available on the Event Portal. Select the DriverUpserted event, and click on OK. image020 Boomi grabs the schema from the Event Portal and creates a response profile (you'll use this for mapping in a later section). It also brings the topic subscription format from Event Portal. image021

⚙️ Package and deploy

  1. Save the Process, then click on Create Packaged Component using default options. Proceed to Deploy the new components to your atom. image022
  2. Ensure that the Solace listener is up and running by going to Manage > Atom Management image023
  3. Click on your atom image024
  4. In the middle column, select Listeners image025
  5. You should see the listener up and running, with a green circle next to it. image026

image027

And Now-One Quick Fix

  1. Go back to the Solace UI, click on Messaging Services in the upper left, then select the messaging service that you created.
  2. Click on Manage manage
  3. Click on Queues queues
  4. Click on the +Queue button to create a new queue to hold events that have failed processing newqueue
  5. In the popup, name the new queue #DEAD_MSG_QUEUE and hit Done.
  6. Click on the input queue for your Boomi Process: NYCTAXI.BACKOFFICE.BOOMI.UPDATEDRIVERDB queue updatequeue
  7. Click on the Edit button (with the pencil) in the upper right
  8. Click on Show Advanced Settings in the upper right
  9. Change the Maximum Redelivery Count field to 3. This moves a failed event to a queue named #DEAD_MSG_QUEUE after 3 attempts. redelivery

You will reuse the Solace connector you created in the last step, so you'll just need to modify the Solace connector operation.

  1. Open the "Hello World - Publish Solace Event" process, and click on the Publish DriverUpsertedEvent operation image028
  2. You'll note that the sample code has already filled in the destination topic. sendoperation
  3. Since this process doesn't use a Listen, we can just use Boomi's test functionality. Click on the Test button and choose your atom.
  4. Once the test completes, go to Manage > Process Reporting image030
  5. You should see an execution of the Hello World Listener image031
  6. Click to view the logs and see that the process received the message successfully. So what did you just do? You now have a complete Boomi and Solace integration, with the first Boomi process publishing a message on a topic. Solace examines the topic string on the event, finds a matching subscription and puts the event on a queue. A second Boomi process is listening for events that land on that queue, so when a event does land there, the process instantly triggers. image032

⚙️ Salesforce configuration

  1. Log into your Salesforce Developer account
  2. Switch to the Setup view using the button in the upper right hand corner image033
  3. In left hand column, expand out Apps, then click on App Manager image034
  4. Click on "New Connected App" image035
  5. Configure the Connected App image036

1.Click on Save. In the next screen, Copy and paste the consumer key and consumer secret into a text editor. You'll use the values when you're configuring Boomi's Salesforce Platform Event connector. image039

⚙️ Define Platform Event structure

  1. Type "platform" into the quick find box in the left-hand column and click on "Platform Events" image040
  2. Click on New Platform Event image041
  3. Use AccountChanged as the label for the event and click on Save. image042
  4. Add the following Custom Fields by repeatedly clicking on the "New" button and following the instructions. Note that spelling does matter, so please be careful. image043

⚙️ Create a trigger that populates and publishes the Platform Event

  1. In the upper right-hand portion of the screen, click on Developer Console image044
  2. Go to File > New > Apex Trigger image045
  3. In the popup, enter the following values and click on submit: image046
  4. Download the Account Change trigger definition Cut and paste the code into the main code area and save.

⚙️ Test it out using Salesforce Workbench

  1. In a new tab, go to https://workbench.developerforce.com/login.php. Accept the term and click Login with Salesforce image047
  2. Select "Stream Push Topics" from the Jump To menu image048
  3. Click on the Generic Subscriptions radio button image049
  4. In the subscription field, enter /event/AccountChanged__e
  5. Back in Salesforce, leave the Setup section of Salesforce, and go to the Sales Console image050
  6. Create a new account. image051
  7. Enter the name of the driver, phone number and billing address information. Be sure to set the Active dropdown to of the account to "active", as only active accounts are sent over to the Driver database. image052image053image054
  8. Move back to the workbench tab. You should see data from your newly created account. image055
  1. Open the "Hello World - Listen for Salesforce Platform Event" sample process. image056
  2. Click on the Start shape, then select "Salesforce Platform Events" in the dropdown
  3. Click on the plus sign in the Connection box to create a new connection to Salesforce
  4. Cut and paste the Client ID from the previous step into the Client ID box
  5. Cut and paste the Client Secret into the Client Secret box.

Scroll to the bottom of the screen and click on Generate image057

image058

You'll see the following if it's successful: image059image060

  1. Click on Save and Close
  2. Click on the Plus sign next to Connector operation to create a new operation.
  3. Click on Import in the upper right corner image061
  4. Fill out the Import wizard with your local atom, and your newly created connection. image062
  5. You should see your account change event listed. image063
  6. Before plunging further, deploy your testing flow using the typical deployment routine. Then make a change within Salesforce and see if it reaches Boomi.
  1. Login to https://portal.azure.com/
  2. In the top menu got to SQL Databases > Create image064
  3. Enter your Subscription and Resource Group, creating a new one if needed
  4. Database name should be taxinyc
  5. Create a new server. Note that the server name must be unique, so find one that's available. image065
  6. In a text editor, save the Server name (including .database.windows.net), server admin login, and the password for later.
  7. Under Compute+Storage, change options to "serverless"
  8. Click on review and create image066
  9. Deployment starts. Once it's finished, click on "Go to resource" image067
  10. To allow connections into the database, you need to create a firewall rule that allows certain IP addresses to connect.

Click on Set Server Firewall. In the firewall rules section create a rule that looks like this: image069

Click on Save

  1. Now you can start set up the Driver table. Click on the query editor image070

Create the table by cutting and pasting this code into the Query tab, then clicking on Run

CREATE TABLE Drivers (
 driver_id int IDENTITY(1,1) PRIMARY KEY,
 first_name varchar(255) ,
 last_name varchar(255),
 rating int,
 car_class varchar(10),
 salesforce_id varchar(255) UNIQUE,
 account_status varchar(12),
	background_status varchar(10),
 account_type varchar(10),
 billing_street_address varchar(255),
 billing_city varchar(255),
 billing_state varchar(10),
 billing_zip varchar(10)
);

image071

  1. Confirm that the table exists: image072
  1. If you are using a local atom, need to do some extra steps to add the SQL jar:
    1. Download jar from here: https://docs.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server
    2. Extract the zip file
    3. Copy mssql-jdbc-8.2.2.jre8.jar to <Boomi install directory>/userlib/database . If those directories don't exist, just create them.
    4. End result should look like this, where the highlighted portion depends on how you installed the Atom image073
  2. OK, back to the fun stuff: In another tab, head back to the Boomi UI
  3. Open the "Azure SQL Database Connection – taxinyc"
  4. Open the "Hello World - Select from/Insert into Azure SQL" process
  5. Fill in the connection details you saved in the last section. The value for the host will be different than the one listed here. image073
  6. Click on Test Connection, you should get a "success" message. If not, check your connection values. Save and close.
  7. Open the Hello World - Select from/Insert into Azure SQL process.
  8. Click on the "Test" button
  9. Once it runs, return to the Azure UI, and get the data you just inserted. image074
  10. Return to Boomi, double click on the "Sample data for testing" shape, and change the first name image075
  11. Rerun the test and confirm that the data has changed. image076
  1. Now that we have all the components tested individually, we can use the Solace event broker to tie them all together. overallarchitecture
  2. First, undeploy all the processes we used for testing. Go to Deploy > Deployments image077

Undeploy any "Hello World" processes that are deployed image078

  1. Open the "Listen for Salesforce Platform Account, publish Solace DriverUpserted" process. Expanding on the Hello World functionality, here are the differences: image079

Rather than using the same topic, here the code change the topic string based on whether the account is active, just was activated or was deactivated image080

There is now a mapping from the Salesforce event over into the standard Solace event. image081

At the end of the process, Boomi publishes the message to Solace, on the topic string you generate earlier in the process.

  1. You don't need to make any changes, just create a packaged component and deploy it as usual
  2. Open up the "Listen for Solace DriverUpserted, Insert into Drivers" process. This process also expands on the Hello World flows. Rather than just using canned data, it listens for events on the queue you created earlier. As Solace publishes DriverUpserted events, they land on the queue. The process grabs them and inserts or updates the Driver table.
  3. Create a Packaged Component and deploy.
  4. The world is your oyster. Log back into Salesforce and add and modify Accounts. As you do, they should stream in real time over Boomi and Solace, and instantly land in the SQL database

Congratulations, you now have a functioning, real-time, event-driven Salesforce implementation. No more worries about your operational database lagging behind Salesforce. Because no one likes an angry cabbie. Although seeing event move quickly though an enterprise is pretty cool, this is just the beginning. Event enabling Salesforce vastly simplifies adding on additional information consumers. Like we mentioned in the beginning—need to add a background check? Just add another process with a subscription and add the logic. Want to add real-time analytics? Send the DriverUpserted events to Kafka. Now that you have real-time data flowing, the possibilities are endless.

Thanks for participating in this codelab! Let us know what you thought in the Solace Community Forum! If you found any issues along the way we'd appreciate it if you'd raise them by clicking the Report a mistake button at the bottom left of this codelab.