源码搭建Openfire 4.3.2 note

源码部署Openfire 4.3.2 troubleshooting:
    1:war-maven-plugin 2.6一直下载不成功,配置文件改成了3.2.0
    2:根据源码里documentation的source-build.html文件步骤执行
    3:执行mvn test的时候抛了一个关于surefire plugin的error,需要maven 3.6以上的版本
    
Openfire 消息处理的入口:ConnectionHandler.messageReceived()方法。
ConnectionHandler实现的mina框架提供的api,用来处理IO。

Openfire 4.3.2 之 Presence
   Scenario:用户A改变自己的presence, 用户B希望收到用户A presence的推送
   Troubleshooting
        当用户A send presence to openfire的时候,会经过PresenceUpdateHandler.broadcastUpdate(Presence update),
        然后由Roster来广播presence。
        
        Roster中一段代码:
        item.getSubStatus() == RosterItem.SUB_BOTH || item.getSubStatus() == RosterItem.SUB_FROM
        presence只会广播给订阅了用户A(presence sender)的用户。查看ofRoster表,sub字段都没数据,所以其他用户收不到用户A的presence包。
        RosterItem -》SubType各个枚举项意思,refer to (
                                                doc url: https://xmpp.org/extensions/xep-0162.html 
                                                1.2 Overview of subscription states
                                            )
    Solutions
        - Openfire官网提供了subscription插件,下载后copy到distribution\target\distribution-base\plugins文件夹下,
        启动openfire的时候会自动加载该插件。并在admin console -》Subscription Service Settings中设置accept subscription requests。
        用户希望收到谁的presence推送,可以发送type=subscribe的presence包到openfire,openfire会自动同意。被订阅的用户改变presence时,
        订阅方RosterListener就可收到该推送。

Openfire 4.3.2 之 Plugins
    Openfire custom plugin development:(视项目实际结构而定)
        Steps
            - 创建plugins module的子module
            - 子module的pom.xml文件中build标签中添加maven-assembly-plugin
            - 修改openfire-plugin-assembly-descriptor module的openfire-plugin-assembly.xml文件。
             (按照自己module的目录结构修改配置,保证生成的jar包的目录结构和官网要求的plugin的目录结构保持一致)
            - 打包后copy到distribution\target\distribution-base\plugins
        Note: 如果还没有配置openfire,启动时只会先加载admin plugin,配置结束后才会加载其他plugin。
          如果已配置openfire,启动的时候会加载所有插件。
        Doc refer to:
            https://www.jianshu.com/p/869cb5688cac
            http://download.igniterealtime.org/openfire/docs/latest/documentation/plugin-dev-guide.html
    自动将plugin打包并copy到openfireHome\plugins:(视项目实际结构而定)
        - parent module的pom.xml添加自定义插件的依赖。
        - distribution module -》pom.xml -》maven-dependency-plugin 添加自定义插件的<artifactItem>,格式参照search
          artifactItem
        - 执行parent module的package task。
 
 
创建plugin子module:
右键项目-》new module -》 Next
  Add as module to -》org.igniterealtime.openfire:plugins
  Parent -》 org.igniterealtime.openfire:plugins
  GroupId -》org.igniterealtime.openfire.plugins
  ArtifactId -》 openfire-plugin-archive
Next:
  Module name:openfire-plugin-archive
  Content root: D:\IDEAProjects\Openfire-4.3.2\plugins\openfire-plugin-archive
  Module file location:D:\IDEAProjects\Openfire-4.3.2\plugins\openfire-plugin-archive
Finish
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值