Tigase 外部组件作为单个罐子

Tigase external component as a single jar

我已经实现了具有某些功能的 tigase 组件,现在正试图弄清楚如何将它用作外部组件。 现在看来我必须用我的组件设置单独的 tigase 服务器,然后配置主 tigase 服务器以将该单独的服务器作为外部组件引用。

我想做的是 assemble 将外部 tigase 放入一个 jar 中,以便能够 运行 使用一行命令就可以 运行 它而无需预先安装 tigase。

问题是这可能吗?

tigase 似乎需要数据库才能 运行,并且管理指南鼓励对外部组件使用共享主服务器的数据库。我不确定 tigase 是否可以在没有数据库的情况下启动,这使得使用简单的 java -jar 命令很难 运行。

是的,Tigase 组件 Framework/API 需要 Tigase 服务器核心到 运行。而且您只需将自定义组件加载到 Tigase 服务器核心。 为简单起见,建议在 Tigase 主 XMPP 服务器和组件实例之间共享数据库,但不是强制性的。我认为外部组件实例甚至可以 运行 带有虚拟数据库连接器,如果真的不需要数据库的话。

For now it seems I have to set up separate tigase server with my component on it and then configure main tigase server to refer to that separate server as an external component.

这是正确的。 Tigase XMPP 服务器在这方面遵循 XEP-0114: Jabber Component Protocol and XEP-0225: Component Connections。请参阅 External Component Configuration 了解如何在 Tigase 中配置它的详细信息。

What I would like to do is to assemble that external tigase into a single jar in order to be able to run it with one line command without installing tigase upfront. Question is is it possible at all?

您可以创建一个 "uber jar" - 是的,这是可能的。一种可能的解决方案是将组件创建为单独的 Maven 项目,将 tigase-server 配置为依赖项,然后利用 jar-with-dependenciesApache Maven Assembly Plugin。它将拉取所有必需的、配置的依赖项并将它们放在单个 jar 文件中。但是请注意,例如数据库驱动程序将不包括在内。

It seems that tigase needs database to run and administration guide encourages to use shared main server's database for external components. I'm not sure if tigase can start without database which makes it rather hard to run with simple java -jar command.

确实需要数据库 - 这有利于使您的配置与可能 运行 您的外部组件的许多节点保持一致(您只需要在一个节点上更新一次,其余所有节点将自动更新它),但您不必使用主服务器数据库。详情请参阅 Usage with a separate database。 如果您只使用外部组件的单个本地实例,那么您可以创建一个简单的 derby 数据库并将您的配置放在 etc/externalComponentItems 文件