Skip to main content Skip to complementary content

Audit Service

The Audit Service will listen to a JMS queue and will simply log the message on the console.

Procedure

  1. Create a new route and place the components as displayed below.
    You have cMQConnectionFactory, cJMS, cProcessor and cMessagingEndpoint components in the designer canvas.

    You need to configure the Broker URL of the MQ Connection Factory to your Active MQ Broker Server which is tcp://localhost:61616, in this example.

    You are running a local instance of ActiveMQ which is part of Talend ESB. The cJMS component is configured to listen the queue audit.

  2. Use the cProcessor component to enrich the camel Exchange.
    String audit = "Audit Message Received: "+ exchange.getIn().getBody(String.class);                    
  3. Configure the cMessagingEndpoint component as a Camel Log component.
    "log:AuditLog?showAll=true&multiline=true"

    The Audit Service will now listen to the Queue audit and will log it on the console. This message can be saved to the database for auditing purposes. You can run the route to verify that it compiles and runs correctly at this point.

  4. To export the Audit Service as a Microservice, in the Deployment tab of the Route view, select Microservice in the Build Type list. Save the Route.
  5. In the Repository tree view, right click the Route and select Build Route.
  6. The build type is set to Microservices. Click Finish to export the Route.
  7. To run Microservice, locate the 'Audit****.jar file where you have saved it and run it using java -jar command.
    java -jar AuditService_0.1.jar --server.port=8066  

    By default, the monitoring port is 8605 which can be overwritten by passing simple parameter --server.port=port to the java command starting the service.

    This port is used to monitor the status of the service and is discussed in next section.

    The microservice can be exported as a zip file that contains the Windows and Linux scripts (.bat and .sh) to help with starting up the microservice.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!