Integrate external service into micro-service system

In the big picture of micro-service system, it’s completely feasible sometimes we decide to leverage existing facility service instead of build that service. By this way, we could bring the system to the market sooner.

During integration the particular external services, we recognized that the goal goes beyond the leverage the functional feature provided by that services. The side effect of the integration is we gradually become dependent on those services, we could not witch to the other service which probably provides a better quality of functionality. Hence, how to keep the system portable enough to move forward with other service providers is one of technical challenge.

Continue reading

Simple way to integrate BPMN activiti with Spring Integration

BPMN 2 is an popular business process definition and execution standard. Alfresco Activiti is one of the most famous provider. Using BPMN shorten the distance between business and development perspective. It also enable the visibility of any complex business logic. Additionally, it also increase the portability of the business logic with the underline execution engine and therefore make the workflow application become enough flexible to adapt with the rapid change of the business demand.

Continue reading

Basic between websocket, stomp and sockjs with spring framework

We all understand that websocket is a full-duplex protocol that support bidirectional communication between client and server. However, during using this technology with spring framework, our first common issue is misconception websocket with stomp and sockjs together.

STOMP and SosckJS are different frameworks adding different features on top of websocket.

Continue reading

Spring JMS

Initialize project with ActiveQM Client


Enable JMS configuration

public class IntegrationConfiguration {


Add integration layer controller

public class EmployeeJms {

    private EmployeeService service;

    @JmsListener(destination = "employee-info-request")
    public String getDepartment(String employeeId) {
        return service.getDepartment(employeeId);

Simulation for business

public class EmployeeService {

    private static final Logger LOGGER = LoggerFactory

    public String getDepartment(String employeeId) {"Begin get department info of employee [{}]", employeeId);
        simulateQuery(employeeId, 3);"End get department info of employee [{}]", employeeId);
        return "Technology";

    private void simulateQuery(String employeeId, int processTime) {
        try {
        catch (InterruptedException e) {


Configure to point to Message Broker

        name: spring-jms default
        in-memory: false
        broker-url: tcp://activemq-dev:61616
        user: admin
        password: admin
            auto-startup: true
            concurrency: 3
            max-concurrency: 3

Spring Cloud Config Server pushes local changes

Create the Spring Cloud Config Server application

Add configuration

        name: config-server
        active: default
                initialInterval: 100000
                multiplier: 1.1
                maxInterval: 900000
                maxAttempts: 6
                    label: dev-local
                    search-paths: '*'
                    skipSslValidation: false
                    ignoreLocalSshSettings: true
                    strictHostKeyChecking: false
                    clone-on-start: true
                    force-pull: true
                    basedir: ${user.home}/data/configuration-repository
                    username: test_gitlab
                    password: ENC(07b8RBlZEtbdwVMjUBtlyeFPWBIfoVBl)

Add some extended functions for pushing changes

public class ConfigurationManagementServiceImpl
        implements ConfigurationManagementService {

    private static final Logger LOGGER = LoggerFactory

    private Git git = null;

    private MultipleJGitEnvironmentRepository repository;

    public void commitAndPush(
        final String application,
        final String profile,
        final String label,
        final String message) throws Exception {


        // Make the local repository ready
        this.repository.getLocations(application, profile, label);


            .call();"Pushed local repository with message [{}].", message);

    private File getWorkingDirectory() {
        return this.repository.getBasedir();

    private void init() throws IOException {
        if (this.git != null) {

        final String repoPath = this.repository.getBasedir().getPath();
        final Repository localRepo = new FileRepository(repoPath + "/.git");
        this.git = new Git(localRepo);"Initialized local repository at path {}", repoPath);

    private void updateLocalRepo() throws Exception {"Updating the local repository.");