package com.elab.mq.rocket.msg;

import com.elab.mq.rocket.App;
import org.apache.rocketmq.client.hook.ConsumeMessageHook;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.io.IOException;
import java.util.Map;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = {App.class})
//@AutoConfigureMockMvc
public class DefaultSendMessageHookTest {

    @Autowired
    private Map<String, ConsumeMessageHook> consumeMessageHookMap;

    @Autowired
    private RocketMQTemplate rocketMQTemplate;

    @Value("${demo.rocketmq.topic}")
    private String topic;


    @Test
    public void sendMessageBefore() throws IOException {
        consumeMessageHookMap.forEach((K, V) -> {

        });
        System.out.println("-------------");
        rocketMQTemplate.syncSend(topic, "aaaaaa");
        System.in.read();
    }

    public void sendMessageAfter() {
    }
}
