1

在@BalusC 的帮助下,我的 EJB 方法使用在 EE8 上运行的 JSF 2.3 在 JBoss WildFly 12.0.0.Final (MacOS) 上触发了一个事件:

beanManager.fireEvent("updateNotifications" );

POJO:

@Inject
@Push(channel = "testChannel")
private PushContext pushContext;

public void onPersist(@Observes String notification) {
    logger.info("***** onPersist notification = {}", notification);
    pushContext.send("updateNotifications");
}

接收并打印消息;

16:03:36,682 INFO [com.notifywell.ejb.FoodsCosmeticsMedicinesEJB](默认任务 3)>>>>> insertFoodsCosmeticsMedicinesEJB beanManager = 用于 NOTiFYwell.ear/NOTiFYwellJAR.jar/ [bean count=39] 的焊接 BeanManager

16:03:36,695 INFO [com.notifywell.push.PushBean](默认任务 3)***** onPersist 通知 = updateNotifications

我无法通过 Push Send 与 XHTML 进行通信。我已经尝试过使用 OmniFaces 3.1 和 JBoss WildFly 12 JSF 2.3 并且没有重新渲染(此处未显示 XHTML 代码)。使用 OmniFaces 3.1 时,我无法显示 onmessage:

<h:form>
    <o:socket channel="testChannel" onmessage="socketListener"/>
    <h:outputScript>
        function socketListener(message, channel, event) {
            console.log(message);
        }
    </h:outputScript>
</h:form>

如果我在 Chrome 中打开控制台日志,它是空的,没有“消息”。

在 WireShark 我看到:

2601 9.810264 ::1 ::1 HTTP 997 GET /NOTiFYwell/omnifaces.push/testChannel?a1ef3363-dc5a-4153-a4c7-73b0e183713d HTTP/1.1

就好像

pushContext.send(notification);

没有被执行。

4

1 回答 1

1

我与 Wildfly 14 的情况完全相同。

为了解决这个问题,我必须:

  1. 取消部署应用程序
  2. 关闭服务器
  3. 清除独立中 tmp 文件夹的内容
  4. 启动服务器
  5. 部署

现在它可以工作了,但是如果我在没有步骤 1-4 的情况下进行部署,它将无法再次工作。(也许第 3 步不是必需的,但我这样做是因为我遇到了很多其他错误)

于 2018-09-27T11:03:38.147 回答