AliwareMQ/mq-demo

我怎么才能在 listener 中把 message 的内容,发送 post 给我的服务器呢?

Opened this issue · 0 comments

public Action consume(Message message, ConsumeContext context) {
        System.out.println(" Receive: " + message);
        String body = new String(message.getBody());
        System.out.println(" body: " + body);
        this.setMessage(message);

        try {
       //官方的 spring 例子中写的 dosomething
            String url = "http://114.215.202.178:3002/v1/base2pro/appliance/data/report";
            String result;
            result = HttpUtils.API(url);//使用的import org.apache.http.client.HttpClient;这种第三方类,底层一直会报错class Not Found!
            System.out.println("send ok:" + result);

            return Action.CommitMessage;
        } catch (Exception e) {
            //消费失败
            return Action.ReconsumeLater;
        }
    }