微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

org.apache.camel.MultipleConsumersSupport的实例源码

项目:Camel    文件DefaultCamelContext.java   
private boolean doCheckMultipleConsumerSupportClash(Endpoint endpoint,List<Endpoint> routeInputs) {
    // is multiple consumers supported
    boolean multipleConsumeRSSupported = false;
    if (endpoint instanceof MultipleConsumeRSSupport) {
        multipleConsumeRSSupported = ((MultipleConsumeRSSupport) endpoint).isMultipleConsumeRSSupported();
    }

    if (multipleConsumeRSSupported) {
        // multiple consumer allowed,so return true
        return true;
    }

    // check in progress list
    if (routeInputs.contains(endpoint)) {
        return false;
    }

    return true;
}
项目:Camel    文件QuickfixjComponentTest.java   
@Test
public void createEndpointBeforeComponentStart() throws Exception {
    setUpComponent();

    settings.setString(sessionID,SessionFactory.SETTING_CONNECTION_TYPE,SessionFactory.INITIATOR_CONNECTION_TYPE);
    settings.setLong(sessionID,Initiator.SETTING_SOCKET_CONNECT_PORT,1234);

    writeSettings(settings,true);

    // Should use cached QFJ engine
    Endpoint e1 = component.createEndpoint(getEndpointUri(settingsFile.getName(),null));
    assertthat(component.getProvisionalEngines().size(),is(1));
    assertthat(component.getProvisionalEngines().get(settingsFile.getName()),is(notNullValue()));
    assertthat(component.getProvisionalEngines().get(settingsFile.getName()).isInitialized(),is(true));
    assertthat(component.getProvisionalEngines().get(settingsFile.getName()).isstarted(),is(false));
    assertthat(component.getEngines().size(),is(0));
    assertthat(((QuickfixjEndpoint)e1).getSessionID(),is(nullValue()));

    writeSettings(settings,false);

    // Should use cached QFJ engine
    Endpoint e2 = component.createEndpoint(getEndpointUri(settingsFile2.getName(),is(2));
    assertthat(component.getProvisionalEngines().get(settingsFile.getName()),is(0));
    assertthat(((QuickfixjEndpoint)e2).getSessionID(),is(nullValue()));

    // will start the component
    camelContext.start();

    assertthat(component.getProvisionalEngines().size(),is(0));
    assertthat(component.getEngines().size(),is(2));
    assertthat(component.getEngines().get(settingsFile.getName()).isInitialized(),is(true));
    assertthat(component.getEngines().get(settingsFile.getName()).isstarted(),is(true));

    // Move these too an endpoint testcase if one exists
    assertthat(e1.isSingleton(),is(true));
    assertthat(((MultipleConsumeRSSupport)e1).isMultipleConsumeRSSupported(),is(true));
    assertthat(e2.isSingleton(),is(true));
    assertthat(((MultipleConsumeRSSupport)e2).isMultipleConsumeRSSupported(),is(true));
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。