RestNotificationRule.java 文件源码

java
阅读 28 收藏 0 点赞 0 评论 0

项目:Unicorn 作者:
@Override
/*
 * No longer persisting RestNotificationForQuery 
 */
public boolean trigger(final Map<Object, Serializable> eventObject) {
    try {
        final JSONObject event = NotificationRuleUtils.toJSON(eventObject);
        //final RestNotificationForQuery notification = new RestNotificationForQuery(event.toString(), this);
        // no longer storing the notifications, as they were causing errors with JPA
        // probably because the entity was configured incorrectly. However, as no one
        // ever looks them up again, we should stop persisting these anyway.
        //notification.save();

        Client client = ClientBuilder.newClient();
        WebTarget target = client.target(this.notificationPath);

        Response response = target.request().post(javax.ws.rs.client.Entity.json(event.toString()));
        return response.getStatus() == 200;
    } catch (UnsupportedJsonTransformation e) {
        e.printStackTrace();
    }
    return false;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号