Skip to content

添加自定义MessagePipeConfiguration的配置类接口 #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 7, 2020

Conversation

hengboy
Copy link
Member

@hengboy hengboy commented Sep 7, 2020

No description provided.

@hengboy hengboy added the kind/feature New features label Sep 7, 2020
@hengboy hengboy self-assigned this Sep 7, 2020
@hengboy hengboy linked an issue Sep 7, 2020 that may be closed by this pull request
@hengboy hengboy merged commit ede9938 into minbox-projects:2.3.x Sep 7, 2020
@hengboy
Copy link
Member Author

hengboy commented Sep 7, 2020

使用方式参考:

/**
 * 自定义配置{@link org.minbox.framework.message.pipe.core.transport.RequestIdGenerator}
 *
 * @author 恒宇少年
 */
@Component
public class RequestIdCustomizer implements MessagePipeConfigurationCustomizer {
    @Override
    public void customize(MessagePipeConfiguration configuration) {
        RequestIdGenerator generator = new UuidRequestIdGenerator();
        configuration.setRequestIdGenerator(generator);
    }

    /**
     * 使用Uuid随机数生成请求ID
     */
    class UuidRequestIdGenerator implements RequestIdGenerator {
        @Override
        public String generate() {
            return UUID.randomUUID().toString();
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

新增MessagePipeConfiguration配置类的自定义Customizer接口
1 participant