简体   繁体   English

通过副本TCP套接字发送Java对象

[英]Sending Java Objects over replica tcp sockets

I want to transfer Java POJOs via TCP. 我想通过TCP传输Java POJO。

Let A and B be the participants, and C1 be the main connection between them and C2 be another connection to be used if C1 fails. 假设A和B是参与者,并且C1是它们之间的主要连接,而C2是如果C1失败则要使用的另一个连接。

I have two kinds of objects: reliable and non-reliable. 我有两种对象:可靠和不可靠。

When C1 disconnects, each non-transmitted objects and new objects should be sent over C2. 当C1断开连接时,每个未传输的对象和新对象应通过C2发送。 And if C1 established again it will be the main connection, the data will flow over C1. 如果再次建立C1,它将成为主要连接,数据将流经C1。

The participants may need to recognize duplicate objects. 参与者可能需要识别重复的对象。

I don't know so much about ESBs. 我对ESB不太了解。 I looked at Apache Camel a bit. 我看了一下Apache Camel。

Which techologies are there to accomplish the problem above? 有哪些技术可以解决上述问题? eg can Camel exactly do that? 例如,骆驼能做到吗? Is it overenginnering? 过度进取了吗?

Which tags, buzzwords best meet the problem above? 哪些标签,流行词最能解决上述问题? I asked for more googling. 我要求更多谷歌搜索。

Thanks. 谢谢。

Take a look at message brokers they are designed for that, such as Apache ActiveMQ or Apache ActiveMQ Artemis. 看一下为此设计的消息代理,例如Apache ActiveMQ或Apache ActiveMQ Artemis。 They both allow to plugin custom protols to transfer data as Java Objects, JMS, Stomp, AMQP and so on. 它们都允许插入自定义协议,以将数据作为Java对象,JMS,Stomp,AMQP等进行传输。

As you want Java POJOs then JMS can do that as it supports javax.jms.ObjectMessage as the transport. 如果您需要Java POJO,则JMS可以做到这一点,因为它支持javax.jms.ObjectMessage作为传输。 Bear in mind that using POJOs is a tight coupling between the systems, and you would often need to have the same classes (eg Java JARs) between them so the POJOs can be serialized/unserialzed over the wire back to the JVM as Java POJOs. 请记住,使用POJO是系统之间的紧密耦合,并且您经常需要在它们之间具有相同的类(例如Java JAR),以便POJO可以像Java POJO一样通过网络串行化/反序列化回到JVM。

Apache Camel works with JMS using the jms component which can make this easier. Apache Camel使用jms组件与JMS一起使用,可以使此过程变得更加容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM