Skip navigation
All Places > Alfresco Process Services & Activiti (BPM) > Blog > 2017 > May
2017

Amazon Simple Queue Service (SQS) and Apache ActiveMQ ™ are two popular messaging systems/platforms out there. Alfresco Process Services powered by Activiti (APS) can be integrated with these systems in a few different ways. Some of the available options are:

  • Custom extension projects built using Spring libraries
  • Using Apache Camel Component in APS
  • Using Mule Component in APS

 

To demonstrate the first option mentioned above, I built a couple of very simple java projects (one for SQS and one for ActiveMQ). The idea of this blog is to point you to those examples. Since these example projects are really simple, I'll keep this blog really short.

 

The pattern is pretty much the same in both the examples, and is as given below:

  • Establish a connection with the respective messaging system from Alfresco Process Services
  • Listen to a SQS/MQ queue for new messages and start a process for every new message.
  • Send messages to SQS/MQ Queue during the process instance execution.

 

APS Integration with Amazon SQS

Source: GitHub: aps-aws-sqs-extension 

 

APS Integration with Apache ActiveMQ

Source: GitHub: aps-activemq-extension 


To try this out and for more details, please refer the README file available in the above mentioned projects.

This is a continuation of my previous blog post about data models Business Data Integration made easy with Data Models. In this example I'll be showing the integration of Alfresco Process Services powered by Activiti (APS) with Amazon DynamoDB using Data Models. Steps required to set up this example are:

 

  1. Create Amazon DynamoDB tables
  2. Model the Data Model entities in APS web modeler
  3. Model process components using Data Models
  4. DynamoDB Data Model implementation
  5. App publication and Data Model in action

 

Let’s look at each of these steps in detail. Please note that I’ll be using the acronym APS throughout this post to refer to Alfresco Process Services powered by Activiti. The source code required to follow the next steps can be found at GitHub: aps-dynamodb-data-model 

Create Amazon DynamoDB tables

As a first step to run this sample code, the tables should be created in Amazon DynamoDB service.

  1. Sign in to AWS Console https://console.aws.amazon.com/
  2. Select "DynamoDB" from AWS Service List
  3. Create Table "Policy"-> (screenshot below)
    1. Table name : Policy
    2. Primary key : policyId"
  4. Repeat the same steps to create another table called "Claim"
    1. Table name : Claim
    2. Primary key : claimId

Now you have the Amazon DynamoDB business data tables ready for process integration.

Model the Data Model entities in APS web modeler

Next step is to model the business entities in APS Web Modeler. I have already built the data models and they are available in the project. All you have to do is to import the "InsuranceDemoApp.zip" app into your APS instance. Please note that this app is built using APS version 1.6.1 which will not get imported in older versions. If you are using APS version 1.5.X or older, please import the app from my project I used in my previous blog post.

 

Once the app is successfully imported, you should be able to see the data models. A screenshot given below.

Model processes components using Data Models

Now that we have the data models available, we can now start using them in processes and associated components such as process conditions, forms, decision tables etc. If you inspect the two process models which got imported in the previous step, you will find various usages of the data model entities. Some of those are shown below:

 

 

Using Data Model in a process model


Using Data Models in sequence flows

 


Using Data Model in Forms

 


Using Data Models in Decision Tables (DMN)

 

 

Let’s now go to the next step which is the implementation of custom data model which will do the communication between process components and Amazon DynamoDB

 

DynamoDB Data Model implementation

In this step we will be creating an extension project which will eventually do the APS<-->Amazon DynamoDB interactions. You can check out the source code of this implementation at aps-dynamodb-data-model . For step by step instructions on implementing custom data models, please refer Activiti Enterprise Developer Series - Custom Data Models. Since you need a valid licence to access the Alfresco Enterprise repository to build this project, a pre-built library is available in the project for trial users - aps-dynamodb-data-model-1.0.0-SNAPSHOT.jar. Given below are the steps required to deploy the jar file.

  1. Create a file named "aws-credentials.properties" with the following entries and make it available in the APS classpath

aws.accessKey=<your aws access key>
            aws.secretKey=<your aws secret key>
            aws.regionName=<aws region eg:us-east-1>

  1. Deploy aps-dynamodb-data-model-1.0.0-SNAPSHOT.jar file to activiti-app/WEB-INF/lib

App publication and Data Model in action

This is the last step in the process where you can see the data model in action. In order to execute the process, you will need to deploy (publish) the imported app first. You can do it by going to APS App UI -> App Designer -> Apps → InsuranceDemoApp → Publish

Once the process and process components are deployed, you can either execute the process by yourselves and see it in action OR refer to video link in Business Data Integration made easy with Data Models demonstrating data model.

 

Once you run the processes, log back in to AWS Console https://console.aws.amazon.com/ and check the data in respective tables as shown below

 

 

That’s all for now. Again, stay tuned for more data model samples….

“Stencils” provide a very powerful set of capabilities to Alfresco Process Services powered by Activiti (APS) and can be used within the BPMN 2.0 Editor, the Step Editor and the Forms Editor.  Within the context of Forms, Stencils provide the facilities to develop custom form field types. The idea of this blog is to point you to some working form stencil samples.

In the recent weeks I had to build a few of these custom form stencils and thought it would be valuable to share it with the community. If you are someone who are just starting on stencils, I recommend you first read a 101 (introductory) blog on form stencils, which is available at Form Stencils 101.

In this blog I’ll take you through the following 5 form stencils:

  1. Custom Simple Text Input
  2. Grouping Fields using stencil
  3. Custom Grid/Table
  4. Signature Pad
  5. Rich Text Editor

Now let me try and explain these examples a bit more....

Simple Text Input Stencil

Source: github: simple-text-input-stencil

I built this component to demonstrate the implementation of a very simple custom input field using stencil. You might be wondering, why would I need to do this? Most often you may not need such a field in real life, however the idea of this stencil is to demonstrate the basic building blocks, or “Hello World” for a stencil implementation.

Grouping Fields using Stencil

Source: github: group-of-fields-stencil

One of the main use cases around this example is to build reusable domain specific field controls. Eg: Build a single form field called “Address” which will consist of fields such as Address Line, Town, State, Country, Zip Code etc. Building reusable form components very specific to your business data objects makes form modelling really easy. Given below is a screenshot of design time view and runtime view of my example.

 

Design Time View

At design time, the designer will select the custom stencil and configure it with some process data as shown below

Configuration

Run Time View

At runtime, the stencil will be displayed based on your configuration using your custom html, custom css etc

Custom Grid/Table

Source: github: angular-ui-grid-stencil

I built this component recently for a customer who wanted to display a list of records from a REST API in a tabular format. I have to say that it took only 15 minutes for me to do the research and implement this feature using the Angular UI Grid component. Since APS OOTB UI use this module for the dynamic table component, the angular modules I needed to implement this feature was already part of the product. That made my life easy! So, if you have complex table requirements that cannot be met by the OOTB table component, I recommend you to look at all the features available in this library at Angular UI Grid Tutorial and I’m pretty sure that a stencil component built using the features available in this library can meet most of your needs

 

Important - Since AngularJS doesn't allow module injection after application is bootstrapped, one cannot declare an external module as part of the stencil controller code.

One of the options is to include an external AngularJS module into the "activitiApp" is by modifying "activiti-app/workflow/scripts/<minified script>.js" the following way.

eg: to add ngMap module from ng-map, one should this activitiApp=angular.module("activitiApp",[.,.,.,.,.,.,"ngMap"]) in the main module js file.

 

Please refer the comments where Greg has provided another option to load an external module.

 

Signature Pad

Source: github: signature-pad-stencil

A signature stencil implementation based on Signature Pad

Thanks to Angular Signature for providing the AngularJS directive which I used in my Stencil implementation. My example app, demonstrates the following:

  1. Capture a signature
  2. Display of a signature captured in a previous task
  3. Display the signature in a document that is generated in the process.

Rich Text Editor

Source: github: tinymce-rich-text-editor

A rich text editor stencil implementation based on TinyMCE

Thanks to TinyMCE AngularJS Integration for providing the AngularJS directive which I used in my Stencil implementation.

 

General instructions to run the above examples

The zip archive files available in the above mentioned github source folders are “App” exports. To to use them, you will need to import them via App Designer (Kickstart App) -> Apps -> Import App. Once the “App” is successfully imported, the stencils along with an example process and form will also get imported which will make it easy for you to see these examples in action!

Finally..

Hopefully this is a good set of examples to show the power of stencil component in Alfresco Process Services. If you happen to build any cool form components using stencils, feel free to share it here in the form of a blog or video...

There are more examples available on the product documentation page - APS Docs: Custom Form Fields & Developer Series - Custom Form Fields 

 

Note: I’m in the process of building Alfresco ADF (Application Development Framework) equivalent of these stencils and as soon as they are ready, I’ll make it available and update this blog with the reference. A 101 blog on implementing form stencil components in ADF can be found here - Custom stencils with Alfresco ADF

 

UPDATE: