Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem integrating fiber wtih Apache Camel #328

Open
sakshivijay opened this issue Jun 9, 2019 · 0 comments
Open

Problem integrating fiber wtih Apache Camel #328

sakshivijay opened this issue Jun 9, 2019 · 0 comments

Comments

@sakshivijay
Copy link

I am trying to integrate quasar fiber with Apache Camel. The way I am trying to achieve this is by doing something like this-

Fiber fiberExchange = new Fiber(new SuspendableCallable() {
public Exchange run() throws SuspendExecution, InterruptedException {
return producerTemplate.send(clientURL, exchange);
}
}).start();

fiberExchange.get();

This internally uses HttpClient which was causing CPU hogging but nonetheless I was able to get responses correctly without error.
To solve for CPU hogging, I tried to override HttpClient by FiberHttpClient provided by Comsat-

public class FiberHttpEndpoint extends HttpEndpoint {
public FiberHttpEndpoint(final HttpEndpoint httpEndpoint
, final HttpComponent httpComponent) throws URISyntaxException {
super(httpEndpoint.getEndpointUri()
, httpComponent
, httpEndpoint.getHttpUri()
, httpEndpoint.getClientBuilder()
, httpEndpoint.getClientConnectionManager()
, httpEndpoint.getHttpClientConfigurer());
}

@Override 
protected HttpClient createHttpClient() { 
        return FiberHttpClientBuilder.create(50). // use 2 io threads 
                setMaxConnPerRoute(super.getConnectionsPerRoute()). 
                setMaxConnTotal(super.getMaxTotalConnections()). 
                build(); 
} 

}

public class FiberHttpComponent extends HttpComponent {
private static LoggerFacade LOGGER = LoggerFacadeManager.getLogger(HystrixHttpComponent.class);
public FiberHttpComponent(){
super();
}

@Override 
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { 
    final HttpEndpoint defaultEndpoint = (HttpEndpoint) super.createEndpoint(uri, remaining, parameters); 
    return new FiberHttpEndpoint(defaultEndpoint, this); 
} 

}

And passing this Component while calling the endpoint.
But after doing this change, I have started getting SuspendExecution Error due to uninstrumented methods in Fiber.java exec() method.

I have already enabled “-Dco.paralleluniverse.fibers.verifyInstrumentation=true” but it is now giving any uninstrumented method. VerifyInstrumentation was giving me warning earlier, but it got solved after marking those methods as suspendable. This is resulting in response not getting set correctly set in camel exchange.

Could you please point me to what am I missing here and how can I check which methods are uninstrumented resulting in this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant