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;
}
}