Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix analytics data of template endpoints publishing twice #2144

Merged
merged 2 commits into from
Feb 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,14 @@ public class TemplateEndpoint extends AbstractEndpoint {

@Override
public void send(MessageContext synCtx) {
if (RuntimeStatisticCollector.isStatisticsEnabled()) {
Integer currentIndex = null;
if (getDefinition() != null) {
currentIndex = OpenEventCollector.reportChildEntryEvent(synCtx, getReportingName(),
ComponentType.ENDPOINT, getDefinition().getAspectConfiguration(), true);
}
try {
sendMessage(synCtx);
} finally {
if (currentIndex != null) {
CloseEventCollector.closeEntryEvent(synCtx, getReportingName(), ComponentType.MEDIATOR,
currentIndex, false);
}
}
reLoadAndInitEndpoint(synCtx.getEnvironment());

if (realEndpoint != null) {
realEndpoint.send(synCtx);
} else {
sendMessage(synCtx);
informFailure(synCtx, SynapseConstants.ENDPOINT_IN_DIRECT_NOT_READY,
"Couldn't find the endpoint with the name " + getName() +
" & template : " + template);
}
}

Expand All @@ -80,18 +72,6 @@ protected void createJsonRepresentation() {
endpointJson.put("template", getTemplate());
}

public void sendMessage(MessageContext synCtx) {
reLoadAndInitEndpoint(synCtx.getEnvironment());

if (realEndpoint != null) {
realEndpoint.send(synCtx);
} else {
informFailure(synCtx, SynapseConstants.ENDPOINT_IN_DIRECT_NOT_READY,
"Couldn't find the endpoint with the name " + getName() +
" & template : " + template);
}
}

public Map<String, String> getParameters() {
return parameters;
}
Expand Down
Loading