IBM Worklight 6.0.0.1 - 推送通知轮询在生产环境中不起作用 [英] IBM Worklight 6.0.0.1 - Push notifications polling not working in Production environment

查看:83
本文介绍了IBM Worklight 6.0.0.1 - 推送通知轮询在生产环境中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是:


  • 开发环境时,一切正常 - poller工作正常,数据库状态发生变化等。

  • When in Development environment, everything is OK - the poller is working fine, the DB statuses changes, etc.

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

When in Production environment, nothing appears in the log and nothing changes in the DB (I'm reading notifications from a DB table).



推送通知eventSource:

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>


推荐答案

所以我现在正在运行。
这是一个安全问题。当您在worklight studio和liberty profile上运行本地工作站上的应用程序时,会禁用某些安全功能,而不是生产。

So I got this running now. It was a security problem. When you run the application on your local workstation on worklight studio and liberty profile, some security features are disabled which is not the case of the production.

在开发模式下所有没有显式securityTest的程序默认情况下有wl_inprotected我认为它们是这样做的,以便能够从Eclipse调用过程。在生产环境中,安全性得到增强,wl_unprotected不被视为默认安全测试。

On development mode all the procedures with no explicit securityTest have wl_inprotected by default I think they did it like this in order to be able to invoke procedures from Eclipse. In the production environment the security is enhanced and wl_unprotected is not considered as the default security test.

所以我所做的是为所有程序添加securityTest =wl_unprotected在执行链中,除了sendNotifications程序,它应该保持不进行秒测试。

So what I did is to add securityTest="wl_unprotected" for all the procedures in the execution chain except the sendNotifications procedure which should remain without sec test.

就是这样!

这篇关于IBM Worklight 6.0.0.1 - 推送通知轮询在生产环境中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆