Quickstart on using the Flogo Connector for TIBCO Cloud Messaging

TIBCO Cloud Messaging provides the infrastructure for developing global applications quickly and easily. With simple to use client-side libraries you can develop secure, high performance mobile and web-based applications.

TIBCO Cloud Messaging uses a publish/subscribe model for real-time messaging between devices and web-based applications. Your clients can publish messages with any content, and subscribing clients will receive only those messages with which they have registered interest.

In this document, you will:

  • Create Pub and Sub flows in TCI (App Development in TCI)
  • Create a Pub flow in Flogo WebUI (App Development in Flogo WebUI)

 

App Development in TCI

Configure TCM Connector in TCI

Head over to https://cloud.tibco.com and open the Messaging hexagon.

TIBCO Cloud Hexagons

Copy the wss:// url to the clipboard or record in a side document.  You’ll need this in the next step.

Copy wss:// URL

 

Navigate to the TCI hexagon >> Flogo apps, and click on Connections.

Create app

Select the TIBCO Cloud Messaging Connector:

TIBCO Cloud Messaging Connector configuration

Create Publisher App

Create a new flow and call it TCM Publisher

Create flow

Add a TimerTrigger trigger to the flow and configure with a repeating interval.

Add Timer configuration

Add a TCM Message Publisher activity:

Add TCM Publisher activity

On the Configuration tab, select your TCM Connector.

On the Input Settings tab, let’s input the following JSON schema:

{

    "id": "1234",

    "payload": "ipsum lorem"

}

TCM input schema

On the Input tab, provide values for the activity input.  Here we’re using ‘mydest’ as the destination.

TCM destination configuration

Similarly, provide values for message.id and message.payload

Define message content

Create Subscriber App

Create a new flow and call it TCM Subscriber.

Create flow

Define the Flow Inputs and Outputs.  Copy in the JSON schema from the publish activity, like so:

Message schema

Add a TCM Message Subscriber trigger.  Select your TCM connector and define the Destination as mydest.  

TCM configuration

On the Output Settings tab, input the same schema we used in the publish TCM activity.

Input message schema

On the Output tab, map the Trigger outputs to the Flow inputs.  The screenshot below depicts the mapping for $flow.id.  Do the same for $flow.payload.

Map trigger outputs to flow inputs

Close the dialog window, and now add a LogMessage activity to the flow.

Add LogMessage activity

Echo the incoming message to the log with the following expression:

string.concat(“Received payload: “, $flow.payload, ‘ and ID: ‘, $flow.id)

Map message

 

Deploy TCI Flogo App

To see the fruits of your labor, we’ll push the app and review the app logs.

Navigate back to App level where you can see the Flows.  Click on the Push app button.

App level

After the application is started, click on the Log icon

Click on Log Icon

App Development in Flogo WebUI

Create a new app

Create a new app

Select Microservice profile

Select a profile - Microservice

Create a New Flow

Create New Flow

Install a new activity >> github.com/jvanderl/flogo-components/activity/tcmpub

Install new ActivityInstall activity

Now add the Send TCM Message to the Flow

Add Send TCM Message activity

Provide the activity inputs.  Compared to the TCI App, there are three new fields clientid, destinationname, and messagename  clientid is optional, while destinationname and messagename require you to provide the key name, not the value; that information will be provided in the aptly named destinationvalue and message value fields.

Send TCM Message

So here is probably why you are still reading this post, to post a message to a destination on TCM, define destinationvalue=”_dest”.  That’s the magic value you need.

 

The only misgiving for this open source Flogo activity is that the messagename and messagevalue are simplistically defined; i.e. you can pass only one key/value element of data.

E.g. messagename = “foo”, messagevalue = “bar”, will result in the TCM payload { “foo”: “bar”}.

 

If you do fork the tcmpub activity and create your own TCM Pub activity, please be sure to update here, and we’d be happy to update the documentation.

 

1 Comment

This is more of a Wiki Page.  We revision Wiki pages, but not questions.

Don Johnson - May 06, 2019 - 10:46am ::
+ Add a Comment
Login