citrusframework / citrusframework/citrus

MessageTracingTestListener not generating message files

Open
#668 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
485
Forks
155
Avg merge
4d 22h
Merged PRs (30d)
6

Description

Citrus Version 2.8.0

Using the Java DSL, I am trying to use the MessageTracingTestListener to write messages to files, as described in Section 49 of the User Guide. So far, all I have seen is that the folder is created (citrus-logs/trace/messages) and that it contains no files.

I have created the bean using code like this in a Spring Config class:
~~~
@Bean
public MessageTracingTestListener messageTracingTestListener() {
return new MessageTracingTestListener();
}
~~~

I've noticed that, at startup, two distinct objects of class MessageTracingTestListener are created. If I comment this out, then none are created, so that disproves the hypothesis that some instance is being created in the background.
For one of these instances, onOutboundMessage is called once, and onInboundMessage called twice. This is the expected behavior since my test sends a synchronous SOAP request/response and waits for an asynchronous JMS response.

The User Guide also says that logging listeners need to be added to the WebServiceClient. Since I'm using the Java DSL, I've attempted accomplish this with
~~~
return CitrusEndpoints.soap()
.client()
.defaultUri(getRequestUrl())
.interceptor(new LoggingClientInterceptor())
build();
~~~
When this interceptor is added, only one call is made on the MessageTracingTestListener's onInboundMessage method. My hypothesis is that adding the interceptor interferes with the tracing of the SOAP request/response, which appear as RawMessages.

Again, with the interceptor removed, two calls are made to onInboundMessage. Only the SOAP messages appear as type RawMessage, so the JmsMessage is not added to the internal list of messages. (Looks like a bug?)

In any event, the key symptom is that neither onTestStart nor onTestFinish are called.

Clearly there is an element of configuration that I don't have correct yet. Since I will later try to implement a custom MessageListener, I should learn how to configure this correctly.

Thanks!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.