在春季云流数据流和Rabbitmq中正确使用消费者群体是什么?

时间:2019-01-15 16:22:55

标签: rabbitmq spring-cloud-stream spring-cloud-dataflow

对此采取后续行动:

one SCDF source, 2 processors but only 1 processes each item

this is the graph i'm trying to implement

图片中的2个处理器(del-1和del-2)正在彼此之间毫秒之内接收相同的数据。我正在尝试绑定,因此del-2永远不会收到与del-1相同的东西,反之亦然。因此,显然我的配置不正确,但是我不确定在哪里。

我的处理器具有以下application.properties

spring.application.name=${vcap.application.name:sample-processor}
info.app.name=@project.artifactId@
info.app.description=@project.description@
info.app.version=@project.version@
management.endpoints.web.exposure.include=health,info,bindings
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration
spring.cloud.stream.bindings.input.group=input

“ spring.cloud.stream.bindings.input.group”是否正确指定?

这是处理器代码:

@Transformer(inputChannel = Processor.INPUT, outputChannel = Processor.OUTPUT)
public Object transform(String inputStr) throws InterruptedException{

    ApplicationLog log = new ApplicationLog(this, "timerMessageSource");

    String message = " I AM [" + inputStr + "] AND I HAVE BEEN PROCESSED!!!!!!!";

    log.info("SampleProcessor.transform() incoming inputStr="+inputStr);

    return message;
}

@Transformer批注是否是从application.properties中将这段代码与“ spring.cloud.stream.bindings.input.group”链接的正确方法?还有其他注释吗?

这是我的出处:

private String format = "EEEEE dd MMMMM yyyy HH:mm:ss.SSSZ";
@Bean
@InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "1000", maxMessagesPerPoll = "1"))
public MessageSource<String> timerMessageSource() {
    ApplicationLog log = new ApplicationLog(this, "timerMessageSource");
    String message = new SimpleDateFormat(format).format(new Date());
    log.info("SampleSource.timeMessageSource() message=["+message+"]");
    return () -> new GenericMessage<>(new SimpleDateFormat(format).format(new Date()));
}

我对“值= Source.OUTPUT”感到困惑。这是否意味着我的处理器需要使用不同的名称?

包含@Poller会以某种方式使我出现问题吗?

这是我在SCDF shell中定义2个处理器流(del-1和del-2)的方法:

stream create del-1 --definition ":split > processor-that-does-everything-sleeps5 --spring.cloud.stream.bindings.applicationMetrics.destination=metrics > :merge"

stream create del-2 --definition ":split > processor-that-does-everything-sleeps5 --spring.cloud.stream.bindings.applicationMetrics.destination=metrics > :merge"

我需要在这里做些其他改变吗?

所有这些都在Docker / K8s中运行。

RabbitMQ由bitnami / rabbitmq:3.7.2-r1给出,并配置了以下道具:

RABBITMQ_USERNAME: user
RABBITMQ_PASSWORD <redacted>:  
RABBITMQ_ERL_COOKIE <redacted>:  
RABBITMQ_NODE_PORT_NUMBER: 5672
RABBITMQ_NODE_TYPE: stats
RABBITMQ_NODE_NAME: rabbit@localhost
RABBITMQ_CLUSTER_NODE_NAME: 
RABBITMQ_DEFAULT_VHOST: /
RABBITMQ_MANAGER_PORT_NUMBER: 15672
RABBITMQ_DISK_FREE_LIMIT: "6GiB"

是否需要其他环境变量?

0 个答案:

没有答案