hutaishi opened a new pull request #3013:
URL: https://github.com/apache/incubator-shenyu/pull/3013
Optimize shenyu agent logging #2907
- Optimize the configurable Shenyu agent log collection
- Add traceid.
- refactor code
test method:
setup up a rocketmq
config shenyu-agent.yaml and set rocketmq props.
package shenyu-agent module.
run org.apache.shenyu.admin.ShenyuAdminBootstrap;
add java option "-javaagent:shenyu-agent.jar path" and run
org.apache.shenyu.bootstrap.ShenyuBootstrapApplication
run org.apache.shenyu.examples.http.ShenyuTestHttpApplication;
then send request:
test json request:
curl --location --request POST
'http://localhost:9195/http/order/save?a=1'
--header 'Content-Type: application/json'
--data-raw '{
"id":666,
"name": "hello world"
}'
test upload file:
curl --location --request POST
'http://localhost:9195/http/test/upload?body=hello'
--form 'file=@"your file path"'
test download file:
curl --location --request GET
'http://localhost:9195/http/test/download?body=hello'
then run bellow code:
`
public static void main(String[] args) throws InterruptedException,
MQClientException {
DefaultMQPushConsumer consumer = new
DefaultMQPushConsumer("shenyu-agent-test-group");
consumer.setNamesrvAddr("localhost:9876");
consumer.subscribe("shenyu-agent-logging", "*");
consumer.registerMessageListener((MessageListenerConcurrently) (msgs,
context) -> {
List msgList = msgs.stream().map(v -> new
String(v.getBody())).collect(Collectors.toList());
for (String msg : msgList) {
System.out.println(msg);
}
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
});
consumer.start();
System.out.println("Consumer Started.");
}
`
9.Observe the news of consumer consumption.you can see the result.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]