[ 
https://issues.apache.org/jira/browse/CAMEL-12712?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16578044#comment-16578044
 ] 

Zoran Regvart commented on CAMEL-12712:
---------------------------------------

This part of the test tries to mock Salesforce API:
{code:java}
rest("/services/async/37.0/job/{jobid}/batch")
.description("Mock createBatch")
.post().consumes("application/json").produces("application/xml")
.outType(String.class)
.route().routeId("mock_create_batch_route")
.to("mock:processFileMockOut")
.log("Batch Request body: ${body}")
.log("Batch job id: ${header.jobid}")
.process(exchange -> {
        BatchInfo batchInfo = new BatchInfo();
        batchInfo.setId(RandomStringUtils.randomAlphanumeric(6));
        exchange.getIn().setBody(batchInfo);
})
.log("Batch request processed... now marshalling...")
.marshal(jaxbDataFormat)
.log("Batch Request Response: ${body}");
{code}
from: 
https://github.com/jsight/camel-salesforce-http-aggregator-issue/blob/7943ddd82e38a0f0b7dc2450facde5adf70f0fbf/src/test/java/com/example/camelsalesforce/CamelSalesforceServiceTest.java#L80-L95

I don't see where the test exercises the {{direct:createJobAndGetID}} route 
that uses aggregation and might be relevant to the issue you're describing. The 
above does not generate a HTTP response for the HTTP request 
{{org.apache.camel.component.salesforce.internal.client.DefaultBulkApiClient::createJob}}
 method issued and that's why it blocks -- the Jetty HTTP client is blocked 
waiting for a response from a mocked Salesforce API.

In order to proceed with this I would need a test that's as simple as possible 
in demonstrating the issue. I would suggest that you try to create a much 
simpler test, perhaps using [Wiremock|http://wiremock.org/] to mock Salesforce 
API.

> Camel Salesforce can easily hang when used within an aggregator
> ---------------------------------------------------------------
>
>                 Key: CAMEL-12712
>                 URL: https://issues.apache.org/jira/browse/CAMEL-12712
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-salesforce
>            Reporter: Jesse Sightler
>            Priority: Major
>
> Reproducer project:
> https://github.com/jsight/camel-salesforce-http-aggregator-issue
>  
> Run the unit tests and you will observe it hanging.
>  
> A workaround is also present. Uncomment this line:
> {quote}// .to("seda:enrichWithJobId?waitForTaskToComplete=Always")
> {quote}
>  
> The code that hangs is this:
> {quote}.enrich("direct:createJobAndGetID", new AggregationStrategy() {
>  @Override
>  public Exchange aggregate(Exchange oldExchange, Exchange newExchange)
> Unknown macro: \{ oldExchange.getIn().setHeader("jobId", 
> newExchange.getIn().getBody(JobInfo.class).getId()); return oldExchange; }
> })
> {quote}
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to