• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java WordMatchRouter类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.jivesoftware.xmpp.workgroup.spi.routers.WordMatchRouter的典型用法代码示例。如果您正苦于以下问题:Java WordMatchRouter类的具体用法?Java WordMatchRouter怎么用?Java WordMatchRouter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

WordMatchRouter类属于org.jivesoftware.xmpp.workgroup.spi.routers包,在下文中一共展示了WordMatchRouter类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getBestQueue

点赞 2

import org.jivesoftware.xmpp.workgroup.spi.routers.WordMatchRouter; //导入依赖的package包/类
/**
 * Returns the best {@link RequestQueue} in the specified {@link Workgroup} that could
 * handle the specified {@link UserRequest}.
 *
 * @param workgroup the workgroup where a queue will be searched.
 * @param request the user request to be handled.
 * @return the best RequestQueue in the specified Workgroup.
 */
public RequestQueue getBestQueue(Workgroup workgroup, UserRequest request) {
    WordMatchRouter router = new WordMatchRouter();
    for (RoutingRule rule : getRoutingRules(workgroup)) {
        String query = rule.getQuery();

        boolean handled = router.checkForHits(request.getMetaData(), query);
        if (handled) {
            // Retrieve queue and route to it.
            try {
                return workgroup.getRequestQueue(rule.getQueueID());
            }
            catch (NotFoundException e) {
                Log.error(e.getMessage(), e);
            }
        }
    }

    List<RequestQueue> availableRequestQueues = new ArrayList<RequestQueue>();
    // Route to best queue based on availability.
    for (RequestQueue requestQueue : workgroup.getRequestQueues()) {
        // Skip queues that do not have agents at the moment
        if (requestQueue != null && requestQueue.isOpened()) {
            availableRequestQueues.add(requestQueue);
        }
    }

    Collections.sort(availableRequestQueues, queueComparator);
    return availableRequestQueues.get(0);
}
 

开发者ID:igniterealtime,
项目名称:Openfire,
代码行数:38,
代码来源:RoutingManager.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)