首页 > 解决方案 > 用于切换不同连接的 Jboss wildfly 21/Jboss EAP 7.3 配置

问题描述

我要求客户可以拥有 2 个 Jboss 集群(SYSTEM1、SYSTEM2)。每个集群可以包含 2 个 Jboss EAP 7.3 实例。系统 1 节点 1,节点 2 系统 2 节点 3,节点 4

我的客户进行远程查找以连接远程 Jboss 实例。当 UI 启动时,系统组合框会显示给用户以选择系统。如果用户选择 SYSTEM1,客户端对 Node1、Node2 进行 ejb 调用。如果用户选择 SYSTEM2,客户端对 Node3、Node4 进行 ejb 调用。我能够通过 jboss-ejb-client.properties 提供此功能。

customer.system.names=PROD,QUALITY
remote.clusters=ejb
remote.cluster.ejb.clusternode.selector=com.client.NodeSelector
remote.cluster.ejb.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.cluster.ejb.connect.options.org.xnio.Options.SSL_ENABLED=false
remote.cluster.ejb.username=test
remote.cluster.ejb.password=password

remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=PROD1,PROD2
remote.connection.PROD1.host=localhost
remote.connection.PROD1.port = 8080
remote.connection.PROD1.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connection.PROD2.host=localhost
remote.connection.PROD2.port = 8180
remote.connection.PROD2.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connection.QUALITY1.host=localhost
remote.connection.QUALITY1.port = 8280
remote.connection.QUALITY1.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connection.QUALITY2.host=localhost
remote.connection.QUALITY2.port = 8380
remote.connection.QUALITY2.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

根据用户选择,我正在设置连接正确系统的属性

EJBClientConfiguration cc = new PropertiesBasedEJBClientConfiguration(prop);
ContextSelector<EJBClientContext> selector = new ConfigBasedEJBClientContextSelector(cc);
EJBClientContext.setSelector(selector)

现在这个逻辑不适用于 Jboss EAP7.3。Wildfy Config 是为 ejb 客户端处理而实现的。但是我找不到一种方法来为新的 Jboss 版本提供相同的功能。它不提供聚类功能

标签: javaejbwildflyinitial-contextelytron

解决方案


推荐阅读