I use DOSGi to connect two OSGi components (iPOJO components) over local network.
I configured it with either SOAP or RESTful-JAX RS. However, both use TCP for communication (i saw this in Wireshark).
Now, i would like to configure SOAP or RESTful-JAX RS with UDP. How can i do that?
Thank you for your help.
Assuming this is Apache CXF DOSGI implementation: Given how CXF can use UDP as a transport, it looks simple enough to use a udp URL as your "org.apache.cxf.ws.address" when creating your distributed service.
Thank you very much for your response.
I implemented an application including a server component and a client component
as indicated by
Using Distributed Services with iPOJO.
However, it uses TCP for client-server communication
I tried to declare the server with the "org.apache.cxf.ws.address" property with UDP as "udp://localhost:9090/service".
Example:
<property name="service.exported.interfaces" value="*" />
<property name="service.exported.configs" value="org.apache.cxf.ws" />
<property name="org.apache.cxf.ws.address" value="udp://localhost:9090/service" />
However, i received an error:
Unknown protocol: udp
I'm using the package cxf-dosgi-ri-singlebundle-distribution-1.1.jar for client-server communication
Could you please give me some advices?
Related
I've encounter a problem where our WebSocket connections to ActiveMQ 5.13.3 are terminated abruptly. I thought, I might use WireShark to inspect the TCP layer for clues why the connection may be corrupted, but I'm not sure the ActiveMQ uses TCP protocol as its transport layer protocol for sending the messages.
All the kinds of clients and protocols which ActiveMQ supports use TCP as their transport layer. WebSockets specifically use TCP.
ActiveMQ Broker supports many transport layer protocols, including TCP.
References:
If you are using ActiveMQ Classic:
https://activemq.apache.org/components/classic/
If you are using ActiveMQ Artemis:
https://activemq.apache.org/components/artemis/
I am trying to setup a HA amqp client. There are currently 3 amqps brokers. Currently my client config is as below :
<property name="remoteURI" value="amqps://node1:9551?jms.username=XXXXXXXX&jms.password=XXXXXXXXX&transport.trustStoreLocation=etc/keystore.jks" />
Now since I have 2 other AMQP brokers too, im trying to connect to them too. Firstly is it possible ? According to documentation, for python I can try something like :
connection = qpid.messaging.Connection.establish("node1", reconnect=True, reconnect_urls=["node1", "node2", "node3"])
But for JMS related connection, it states :
connectionfactory.qpidConnectionfactory = amqp://guest:guest#clientid/test?brokerlist='tcp://localhost:5672'&failover='failover_exchange'
But I dont see any indication on how to connect to other brokers.
Any idea how this can be achieved from client side ?
My assumption is that you are using the QpidJMS AMQP v1.0 based client from the Apache Qpid project since you've not given any other information to make a better guess. The way that client would handle failover configuration is on the connection URI, something like:
failover://(amqp://host1:5672,amqp://host2:5672)?jms.username....
You can of course find these things out from reading the documentation.
I have a game server that uses websocket for real time multiplayers. It is a Spring 4 application and I use RabbitMQ as my broker. This is my configuration:
<websocket:message-broker application-destination-prefix="/app">
<websocket:stomp-endpoint path="/portfolio">
<websocket:sockjs/>
</websocket:stomp-endpoint>
<websocket:simple-broker prefix="/queue, /topic"/>
</websocket:message-broker>
From a very small test with 4 clients I saw 4 connections open on Rabbit.
Does each client that connects to my server using websocket eventually open a new connection to the broker (RabbitMQ)? Can this be configured?
Yes, each websocket client gets its own TCP connection to the broker. The documentation has a section for connections to the broker (emphasis mine):
A STOMP broker relay maintains a single "system" TCP connection to the broker. This connection is used for messages originating from the server-side application only, not for receiving messages. [...]
The STOMP broker relay also creates a separate TCP connection for every connected WebSocket client. [ ... ]
If this can be configured or not I don't know, I'm not all that familiar with this part of Spring, but I assume it should be; Spring is open to extension. My suggestion is to post an issue on the spring-websocket-portfolio project and ask for specifics.
EDIT : OP opened the following issue on the spring-websocket-portfolio project.
I'm implementing the TCP client using the Spring Integration.
The requirements are:
1. Through the UDP connection (from somewhere) receive the ip or host address of the TCP server.
2. Open TCP connection to the server, to the destination host from previous step and send some business data to this server.
I use the Spring Integration framework, version "2.2.0.RELEASE", and the problem is that in the default configuration of the tcp-connection-factory the host attribute should be "hardcoded" in xml. For example:
<ip:tcp-connection-factory id="client" type="client" host="localhost" port="1234" single-use="true"/>
The question is how to avoid the static definition of the destination host in application context, and be able to 'lazy' initialise the tcp-connection-factory when the destination host will be known.
I know that this flow could be easily implemented by the standard Network APIs of Java, and the question is specific about the Spring-Integration API
At this time, the configuration is static.
You could however use a similar technique to that used in the dynamic ftp sample which configures ftp outbound adapters at runtime.
As far as <int-ip:tcp-connection-factory> provides some instance of AbstractConnectionFactory. And from other side <int-ip:tcp-outbound-channel-adapter> applies that instance via connection-factory, so, there is no stops to implement your own RoutingConnectionFactory.
The implementation may rely on some value from ThreadLocal. The idea is here:
https://github.com/spring-projects/spring-amqp/blob/master/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/connection/AbstractRoutingConnectionFactory.java,
https://github.com/spring-projects/spring-framework/blob/master/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/lookup/AbstractRoutingDataSource.java
It's not currently possible/easy - even if you customize or extend the class for tcp-connection-factory to be able to connect to changing hosts. There is an open new feature request in JIRA to provide this functionality.
The example given for a spring injected endpoint is as follows:
<endpoint id="hl7listener" uri="mina:tcp://localhost:8888?sync=true&codec=hl7codec"/>
How do I setup a client mode endpoint such that is will connect to a specific port on another server?
How do I configure the endpoint to listen for inbound connections? (the example seems to be a listener as indicated by its descriptive id but why?)
Note: I am not actually using the HL7 protocol or codec. I will be developing my own for a proprietary protocol codec.
was this answered on the thread here?