How to hide specific services from grpc reflection? - reflection

Im currently running a gRPC server with a reflection service as well to expose my services.
Server server = ServerBuilder.forPort(9092)
.addService(ProtoReflectionService.newInstance())
.addService(new StructServiceImpl())
.addService(new ChatServiceImpl()).build();
server.start();
Here, both my StructService and ChatService are exposed via reflection. I need to know whether there is a way to reflect only the ChatService and do not expose the StructService to the external parties?

At the moment ProtoReflectionService does not support this functionality. While not ideal, one thing you could do is running StructServiceImpl in a separate server:
Server structSerivceServer = ServerBuilder.forPort(9093)
.addService(ProtoReflectionService.newInstance())
.addService(new StructServiceImpl())
.build();
structSerivceServer.start();
Server server = ServerBuilder.forPort(9092)
.addService(new ChatServiceImpl())
.build();
server.start();
Feel free to file a feature request at grpc-java GitHub.

Related

Trouble connecting to gRPC server on AWS Fargate

I have a Python gRPC server running on AWS Fargate (configured very similar to this AWS guide here), and another AWS Fargate task (call it the "client") that attempts to make a connection to my gRPC server (also using Python gRPC). However, the client is unable to make a call to my server, with the following error:
<_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = "failed to connect to all addresses"
debug_error_string = "{"created":"#1619057124.216955000","description":"Failed to pick subchannel",
"file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":5397,
"referenced_errors":[{"created":"#1619057124.216950000","description":"failed to connect to all addresses",
"file":"src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc",
"file_line":398,"grpc_status":14}]}"
Based on my reading online, it seems like there are myriad situations in which this error is thrown, and I'm having trouble figuring out which one pertains to my case. Here is some additional information:
When running client and server locally, I am able to successfully connect by having the client connect to localhost:[PORT]
I have configured an application load balancer target group following the guide from AWS here that makes health check requests to the / route of my gRPC server, using the gRPC protocol, and expect gRPC response code 12 (UNIMPLEMENTED); these health check requests are coming back as expected, which I believe implies the load balancer is able to successfully communicate with the server (although I could be misunderstanding)
I configured a service discovery system (following this guide here) that should allow me to reach my gRPC server within my VPC via the name service-name.dev.co.local. I can confirm that the corresponding DNS record exists in Route 53, and when I SSH into my VPC, I am indeed able to ping service-name.dev.co.local successfully.
Anyone have any ideas? Would appreciate any and all advice, and I'm happy to answer any further questions.
Thank you for your help!
on your grpc server use 0.0.0.0:[port] and expose this port with TCP on your container.

Spring 4 WebSocket configure port

Using Spring 4 I need configure WebSocket use other port than HTTP.
In other words by default user access to HTTP and WebSocket as follow:
http://server:9090/
ws://server:9090/
But I need do the follow:
http://server:9090/
ws://server:9999/
In code I have only following:
#Configuration
#EnableWebSocket
public class WebSocketConfig
implements WebSocketConfigurer {
Also I have Handler:
Handler extends TextWebSocketHandler {
Is there such ability in Spring?
AFAIK all current implementations of websockets depend on a handshake via HTTP. After the handshake the existing connection is upgraded. You don't get a new one and the port stays the same. Basically all websocket connections start as HTTP connections.
As a side note the ports, IP addresses etc. are subject of the server, not the application itself.
It might be possible to configure your server so that two ports can be used for an application, but they would both be used for HTTP and websocket alike. On the other hand this might be useful in your situation.
Spring WebSocket different port for ws:// protocol
Due to limitation and in order to use websockets on App Engine Flexible Environment, app need to connect directly to application instance using the instance's public external IP. This IP can be obtained from the metadata server.
All MVC/Rest (http://) call should still serve from 8080 and in App Engine Flexible Environment ws:// server from ws://external_ip:65080
working code
https://github.com/kevendra/springmvc-websocket-sample
http://localhost:8080/
ws://localhost:8080/
to work with App Engine need below
http://localhost:8080/
ws://localhost:65080/ - in local
ws://external_ip:65080/ - App engine
Ref:
Extends org.eclipse.jetty.websocket.server.WebSocketHandler and start server context to 65080, but I'm looking for server managed by spring
How do I create an embedded WebSocket server Jetty 9?
Spring 4 WebSocket Remote Broker configuration

Why using web services over remote connections?

Can we just use remote connections when we need to connect to remote database on remote server?
or we should use web services and what is the web service Architecture? is it differs when we use Lan or internet?
To put it simple: web service are based on remote connections (TCP-connections) between server and client. However web services use standard formats to code and transport requests and answers. There are standard libraries for every platform, taking care of the communications.
The benefit of using web service over remote connections is that you do not have to bother with sockets, coding messages into streams and all the puzzle things. Instead you concentrate on your business logic.
In case of internet, you will need to access a proxy server to access internet. Almost every organisation has proxy server for HTTP and HTTPS, they can be used for web services directly. If you use your own remote connections, you may not able to configure the proxy server to let them through.

Coherence cache for.net client

I am trying to access a coherence cache using .net client.The cluster is already set up , all I have to do is to access the coherence cache from the client side and get the objects from the cacheservice . As of now I have the coherence dll and the client config .what else should I do ?
You should check the 'Developing Remote Clients for Oracle Coherence' guide,
specifically client side configuration:
http://docs.oracle.com/middleware/1212/coherence/COHCG/gs_configextend.htm#BEBEGIAE
The link included in the other answer is a great start. Basically:
You run at least one "proxy" in the cluster
You configure the client to point to the proxy or proxies (or a load balancer in front of the proxies)
You use the Coherence C# API in .NET and it finds the configuration and connects to proxy

Configuring LCDS HTTPProxy service behind a firewall

I have an LCDS server sitting behind a corporate proxy/firewall.
I need to use a configured HTTPProxyService on the LCDS server to make requests out to beyond the firewall (can't go directly from the client because of crossdomain.xml issues)
How do I configure LCDS to use the corporate proxy on it's outbound requests?
Docs ftw:
http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/lcds/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=rpc_config_4.html
Use the <external-proxy /> tag.
LCDS is using Apache HTTP client in order to establish a connection through an external proxy. All the parameters from the tag are going to be used in order to initialize an org.apache.commons.httpclient.UsernamePasswordCredentials instance (or NTCredentials).
I think that first it's easier if you build a standalone java application using HTTP client to use your corporate proxy (easier from a testing point of view), and after you succeed to find all the settings you can add them into proxy-service.xml (I can help you with that).

Resources