apache / rocketmq-spring

Apache RocketMQ Spring Integration
https://rocketmq.apache.org/
Apache License 2.0
2.12k stars 899 forks source link

RocketMQLocalTransactionListener auto config not support placeholder value #143

Closed MartinDai closed 5 years ago

MartinDai commented 5 years ago

BUG REPORT

  1. Please describe the issue you observed:

Here is part of my config code and yml

ClearUserTransactionListener.java

@Component
@RocketMQTransactionListener(txProducerGroup = "${rocketmq.producer.txGroup}")
public class ClearUserTransactionListener implements RocketMQLocalTransactionListener {

//other code

}

application.yml

rocketmq:
  producer:
    txGroup: clearUserGroup

When the ClearUserTransactionListener is initialized,The value of field txProducerGroup will be replaced by clearUserGroup.

Initialization exception

Caused by: org.apache.rocketmq.client.exception.MQClientException: the specified group[${rocketmq.producer.txGroup}] contains illegal characters, allowing only ^[%|a-zA-Z0-9_-]+$
For more information, please visit the url, http://rocketmq.apache.org/docs/faq/
    at org.apache.rocketmq.client.Validators.checkGroup(Validators.java:57)
    at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.checkConfig(DefaultMQProducerImpl.java:218)
    at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.start(DefaultMQProducerImpl.java:177)
    at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.start(DefaultMQProducerImpl.java:169)
    at org.apache.rocketmq.client.producer.DefaultMQProducer.start(DefaultMQProducer.java:285)
    at org.apache.rocketmq.client.producer.TransactionMQProducer.start(TransactionMQProducer.java:57)
    at org.apache.rocketmq.spring.core.RocketMQTemplate.createAndStartTransactionMQProducer(RocketMQTemplate.java:639)
  1. Please tell us about your environment: spring-boot-starter-parent:2.1.4.RELEASE rocketmq-spring-boot-starter:2.0.3
RongtongJin commented 5 years ago

RocketMQLocalTransactionListener does not support resloving placeholder indeed. Welcome to submit a PR to fix it.

MartinDai commented 5 years ago

RocketMQLocalTransactionListener does not support resloving placeholder indeed. Welcome to submit a PR to fix it.

OK,I will try to fix it and submit the PR in the near future.

MartinDai commented 5 years ago

@RongtongJin I found this BUG was fixed by chunhai in master branch,so this issue can be closed. image