Prepare the sample - 6.5

Talend ESB Development Guide

EnrichVersion
6.5
EnrichProdName
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
task
Design and Development
EnrichPlatform
Talend ESB

Reuse the sample from Making SOAP calls with soapUI.

In Contract-first development, in order to use the Service Locator, you needed to add a LocatorFeature. This time, you need to add "org.talend.esb.sam.agent.feature.EventFeature". For more information about how to do this, see Talend ESB Infrastructure Services Configuration Guide.

You also need to give an agent.properties file used to configure sam-agent:

collector.scheduler.interval=500
collector.maxEventsPerCall=10

log.messageContent=true
log.maxContentLength=-1

service.url=http://localhost:8040/services/MonitoringServiceSOAP
service.retry.number=3
service.retry.delay=5000

You can give a logging.properties file for logger:

handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler 

# Set the default logging level for the root logger 
.level = INFO 

# Set the default logging level for new ConsoleHandler instances 
java.util.logging.ConsoleHandler.level = INFO 

# Set the default logging level for new FileHandler instances 
java.util.logging.FileHandler.level = ALL 

# Set the default formatter for new ConsoleHandler instances 
#java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter 
java.util.logging.ConsoleHandler.formatter = // 
    org.sopera.monitoring.util.CustomLogFormatter

# Set the default logging level for the logger named com.mycompany 
#org.talend.esb.sam.level = FINE 
#org.eclipse.persistence.level = INFO
org.talend.esb.sam.level = FINE 
org.eclipse.persistence.level = WARNING

You also need to change pom.xml to add more dependencies and plugins:

Add a dependency for sam-agent:

<dependency>
    <groupId>org.talend.esb</groupId>
    <artifactId>sam-agent</artifactId>
    <version>6.5.1</version>
</dependency>

Change the configuration of maven-bundle-plugin as following:

<plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <extensions>true</extensions>
    <version>2.3.7</version>
    <configuration>
        <instructions>
            <Bundle-SymbolicName>
                ${pom.groupId}.${pom.artifactId}
            </Bundle-SymbolicName>
            <Bundle-Name>${pom.name}</Bundle-Name>
            <Bundle-Version>${pom.version}</Bundle-Version>
            <Export-Package>
                com.example.customerservice
            </Export-Package>
            <Bundle-Activator>
                com.example.customerservice.Activator
            </Bundle-Activator>
            <Require-Bundle>
                org.apache.cxf.bundle;version="",
                org.apache.cxf.bundle,
                org.springframework.beans,
                org.springframework.context,
                sam-agent
            </Require-Bundle>
        </instructions>
    </configuration>
</plugin>

Now the project structure is:

The configuration is finished, now install and deploy it into the OSGi Container, as described in previous chapters.