Can Lagom 1.4 forward websocket error messages? - lagom

I'm using streamed service calls in Lagom. Once I upgraded to 1.4, error messages from the server are not being propagated to the client over websockets. This works in test using the lagomtestkit, but not when running a service using 'runAll' from SBT or in a live deployment.
Using 'runAll', all client calls that fail come back with "Peer closed connection with code 1011 'internal error'"
The issue here is fairly easy to diagnose. Lines 66-68 of akka-http 10.0.11 FrameOutHandler create the WebSocket closeFrame, throwing away the passed in exception and returning "internal error", even though they have the exception message.
My problem is that although I can see the error, I can't see any easy way to fix it without patching akka-http. Is this something that should be supported in Lagom? It used to work in 1.3 when we used the netty client.

Are you testing with another Lagom client connecting directly to the port that the service listens to, or using a web browser or some other client connecting through port 9000?
If it's the latter, you might also need to change the service gateway implementation back to Netty as described in the documentation on Default gateway implementation:
The Lagom development environment provides an implementation of a
Service Gateway based on Akka HTTP and the (now legacy) implementation
based on Netty.
You may opt in to use the old netty implementation.
In the Maven root project pom:
<plugin>
<groupId>com.lightbend.lagom</groupId>
<artifactId>lagom-maven-plugin</artifactId>
<version>${lagom.version}</version>
<configuration>
<serviceGatewayImpl>netty</serviceGatewayImpl>
</configuration>
</plugin>
In sbt:
// Implementation of the service gateway: "akka-http" (default) or
"netty" lagomServiceGatewayImpl in ThisBuild := "netty"
In any case, please create an issue on GitHub and we can investigate a solution in the framework.

Related

MicroProfile Rest client jaxrs connection pool configuration on Open Liberty

I'm implementing a rest client based on MicroProfile Rest Client spec and deployed on Open Liberty 22.0.0.9.
After a few performance tests with JMeter it seems that the connection pool for the rest client is only 10.
How can I change this because it is really not enough for our usage ?
It seems that the underlying client implementation is still cxf (org.apache.cxf.microprofile.client.CxfTypeSafeClientBuilder).
On this page https://openliberty.io/docs/latest/reference/jaxrs-dif.html it is stated that "The underlying JAX-RS implementation for Open Liberty also changed from Apache CXF to RESTEasy."
Does the implementation for jaxrs 2.0 and 2.1 have also switched to Resteasy or is it true only for restfulWS-3.0 ?
Anyway, to change the configuration of cxf I've tried to add a jvm.options property "-Dhttp.maxConnections=100" but it has not effect.
I've also set a RestClientBuilderListener but I don't find any working property to set on the RestClientBuilder...
Any idea how I can achieve this ?
For mpRestClient-2.0:
If used synchronously, then the underlying CXF uses the JDK's HttpURLConnection. By default, HTTP Keep-Alive is enabled and used, unless the server responds with a "Connection: close" response header. If it does not, then the maximum number of cached keep-alive connections per destination host is controlled with -Dhttp.maxConnections=X (default 5). If the server responds with a "Keep-Alive: timeout=X" response header, then the KeepAliveCache will purge and close the connection after approximately X seconds of idleness. If the server does not respond with such a header, the default is 5 seconds and cannot be tuned.
If used asynchronously, then the underlying CXF uses Apache HttpClient, and the HttpClient may be tuned with client.setProperty calls such as
org.apache.cxf.transport.http.async.MAX_CONNECTIONS
org.apache.cxf.transport.http.async.MAX_PER_HOST_CONNECTIONS
org.apache.cxf.transport.http.async.CONNECTION_TTL
org.apache.cxf.transport.http.async.CONNECTION_MAX_IDLE

Using aws xray with apache

My understanding on aws xray is, xray is similar to dynatrace and I am trying to use xray for monitoring apache performance. I do not see any document related to xray with apache except below.
https://mvnrepository.com/artifact/com.amazonaws/aws-xray-recorder-sdk-apache-http
Can anyone please suggest if it is possible to use aws xray with apache and if yes can you also point some document related to it. Thanks.
I assume that by "apache" you mean the Apache Tomcat servlet container, since you are referring to a maven artifact which is a Java build tool.
Disclamer: I don't know what "dynatrace" is and I don't know which logging you specifically want.
But as far as the Apache Tomcat servlet container and X-Ray goes - here is the link to get started:
http://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-java.html
Start by adding AWSXRayServletFilter as a servlet filter to trace incoming requests. A servlet filter creates a segment While the segment is open you can use the SDK client's methods to add information to the segment and create subsegments to trace downstream calls. The SDK also automatically records exceptions that your application throws while the segment is open.
As for the mentioned maven artifact:
aws-xray-recorder-sdk-apache-http – Instruments outbound HTTP calls made with Apache HTTP clients
So, you'll need this if, let's say, a client makes a request to your Tomcat server and your Tomcat server makes a request to another server thus acting as a client in this case.

web service(jax-ws) and weblogic

i have web service(cxf integated with spring(jax-ws)) project which it was deployed on Weblogic(12.1.1).
Another project as client was deployed same application server in another machine.
My problem is that at least 23 second of time for sending info from server to client.(this time is more long),but this time very fast when request is called by Soap Ui.
how can i config weblogic for improvement this problem.
I was searching a lot finally i found solution of my problem.
JaxWSProxyFactoryBean is object of cxf client to communicate with cxf server.
This Object have a property is named Bus,if this property not set in config cxf client,performance wont be better

Propagating client details for remote EJB invocations from standalone Java client

I am looking for a way to propagate client details (like application name, host name, tenant, etc) from a standalone client that is looking up and invoking remote EJBs on a Weblogic 12c server.
I am familiar with similar capabilities in JBoss (https://issues.jboss.org/browse/EJBCLIENT-61) that allow me to register a interceptor and pass additional metadata in the invocation context.
Is there a similar API for WebLogic?
Any pointers, alternatives much appreciated.

How to connect to ActiveMQ on startup with WCF and IIS

What is the best way to combine a single instance WCF service that uses ActiveMQ and runs within IIS/AppFabric?
Our Services need to support both HTTP transports and ActiveMQ (listening and sending messages). We've elected not to use MSMQ, and will use Spring.Net.NMS. The fundamental issue I have now is that ActiveMQ needs to connect to the queue(s) at startup and remain connected, but WAS is getting in the way with it's message-activation feature. If the service is not activated until a message arrives (HTTP/MSMQ, etc) then there is no trigger to have the connection to AMQ occur.
I know I can disable the recycling behavior, and I know I can do self-hosting with a Windows Service. But I want to take advantage of the monitoring and other features in AppFabric. I've already been down the route with IServiceBehavior and will use that for other nice things. But that interface is not called until a (non-AMQ) message arrives. So it won't work for this. What I was hoping for was something along the line of how ServletContextListeners work in Java, where you get both the start up and shutdown events. But it seems no such thing exists in WAS... it is driven only by messages arriving.
I've scoured every inch of web info for 3 days and the only thing I came across was to use a static class construction (C#) trick as the trigger. That's a hack, but i can live with it. It still leaves the issue of cleanly shutting down, which I can figure out later.
Anyone have a solid solution to this?
The direct WCF support for ActiveMQ that Ladislav mentions is still being supported. There just hasn't been an official release for the module in a while. However, you can still get the latest version of it from the 1.5.x branch or trunk and compile it yourself.
1.5.x branch for use with Apache.NMS 1.5.0:
https://svn.apache.org/repos/asf/activemq/activemq-dotnet/Apache.NMS.WCF/branches/1.5.x/
Check out instructions:
http://activemq.apache.org/nms/source.html
There was direct WCF support for ActiveMQ but I guess it is not developed anymore. Your problem actually is the IIS / WAS (provides hosting for non-http protocols) hosting architecture. Services in WAS are always activated when message arrives - there is no global startup. The reason for this is that WAS hosting expects that there is separate process (windows service) running the listener all the time and this process has adapter which calls WAS and uses message level activation. I guess you don't have such process for ActiveMQ and because of that you will have trouble to use ActiveMQ endpoint hosted in WAS. Developing such listener can be challenging task (example for UDP).
Creating custom listener can be probably avoided by using IIS 7.5 / AppFabric auto start feature. There is also not very well documented way to run the code when the application starts.