【问题标题】:IBM Worklight 6.0.0.1 - Push notifications polling not working in Production environmentIBM Worklight 6.0.0.1 - 推送通知轮询在生产环境中不起作用
【发布时间】:2014-01-19 15:43:06
【问题描述】:

我的问题是这样的:

  • 开发环境中,一切正常 - 轮询器工作正常,数据库状态发生变化,等等。

  • 生产环境中,日志中没有任何内容,数据库中也没有任何变化(我正在从数据库表中读取通知)。


推送通知事件来源:

WL.Server.createEventSource({
    name : 'PushEventSource',
    poll : { 
        interval : 360, 
        onPoll : 'sendNotifications' 
    },
    securityTest : 'mobileSecTest' 
});


mobileSecTest 安全测试:

<mobileSecurityTest name="mobileSecTest"> 
    <testUser realm="LdapAdapterRealm"/>
    <testDeviceId provisioningType="none"/>
</mobileSecurityTest>


sendNotifications() 实现:

var notificationServicesResourceName = "PushAdapter";
function sendNotifications(){

WL.Logger.info('Starting to send notifications');
    var lockInvocationData = {
            adapter : "SQLConnector",
            procedure : "isLocked",
            parameters : [ notificationServicesResourceName ]
    };
    var isLockedResult = WL.Server.invokeProcedure(lockInvocationData);
    if (!isLockedResult.locked) {
        lockInvocationData = {
                adapter : "SQLConnector",
                procedure : "acquireLock",
                parameters : [ notificationServicesResourceName ]
        };
        WL.Server.invokeProcedure(lockInvocationData);

//Get the list of all notifications, from external database
        var dbResponse = getAllUnsentNotifications();

        var data = dbResponse.data ;

        /////////////////THE REST OF THE LONG LONG CODE ////////////
        //Reealse lock
        lockInvocationData = {
                adapter : "SQLConnector",
                procedure : "releaseLock",
                parameters : [ notificationServicesResourceName ]
        };
        WL.Server.invokeProcedure(lockInvocationData);
    }
}


适配器 XML 文件:

<wl:adapter name="PushAdapter"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:wl="http://www.worklight.com/integration"
    xmlns:http="http://www.worklight.com/integration/http">

    <displayName>PushAdapter</displayName>
    <description>PushAdapter</description>
    <connectivity>
        <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
            <protocol>http</protocol>
            <domain>${com.ibm.moi.ci.host}</domain>
            <port>${com.ibm.moi.ci.port}</port> 
        </connectionPolicy>
        <loadConstraints maxConcurrentConnectionsPerNode="300" />
    </connectivity>
    <!-- Replace this with appropriate procedures -->
    <procedure name="sendNotifications"/>
    <procedure name="submitNotification"/>

</wl:adapter>

【问题讨论】:

  • 你在服务器端使用WL.Logger.info('Starting the send notifications');吗?
  • 是的。它在我的本地机器上输出日志
  • 如果您从生产服务器添加日志会更好。
  • 日志中没有任何痕迹。我只有在部署适配器后才有这个:00000081 DeployService I com.worklight.integration.services.impl.DeployServiceImpl syncAdaptersFromDB FWLSE0084I:已成功部署适配器“PushAdapter”。
  • @HoucemBerraana,好消息。请将此写为答案并标记为已回答,以便其他人可以从中受益。

标签: push-notification ibm-mobilefirst worklight-server


【解决方案1】:

所以我现在开始运行了。 这是一个安全问题。当您在本地工作站上的 Worklight Studio 和 Liberty Profile 上运行应用程序时,某些安全功能会被禁用,而生产中不会出现这种情况。

在开发模式下,所有没有显式 securityTest 的程序默认都有 wl_inprotected 我认为他们这样做是为了能够从 Eclipse 调用程序。在生产环境中增强了安全性,并且 wl_unprotected 不被视为默认安全测试。

所以我所做的是为执行链中的所有过程添加 securityTest="wl_unprotected",除了应该保持没有 sec 测试的 sendNotifications 过程。

就是这样!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-09-23
    • 1970-01-01
    • 1970-01-01
    • 2014-02-16
    • 1970-01-01
    • 1970-01-01
    • 2016-12-26
    • 1970-01-01
    相关资源
    最近更新 更多