8000 Support to STOMP by framos-dev · Pull Request #88 · gemini-hlsw/gmp · GitHub
[go: up one dir, main page]

Skip to content

Support to STOMP - #88

Open
framos-dev wants to merge 2 commits into
mainfrom
stomp-support
Open

framos-dev wants to merge 2 commits into
mainfrom
stomp-support

Conversation

@framos-dev
Copy link
Copy Markdown
Collaborator

Adds a STOMP connector to the embedded ActiveMQ broker so non-Java clients such as giapi-python (used by InstrumentSequencer.py) can talk to GMP.

Changes

  • Broker: new optional stompUrl property, default stomp+nio://0.0.0.0:61613. Configs without it fall back to the default.
  • Dependencies: adds xstream and jettison, which the STOMP jms-map-json transformation needs for giapi-python commands. Both are included in the gmp-server distribution.

Fixes

  • JmsMapMessageSenderReply: the reply consumer is now created before the request is sent. Before, a fast reply could arrive before GMP was listening and be lost.
  • HandlerResponseSenderReply: a timeout (null reply) returned by the instrument no longer throws a NullPointerException; it returns NOANSWER. Replies that aren't MapMessages are now read from the GMP_HANDLER_RESPONSE headers, and an invalid value returns NOANSWER.

@mergify
mergify Bot commented Nov 11, 2026
Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request

@framos-dev
framos-dev requested a review from cquiroz November 11, 2026 15:32
@cquiroz cquiroz left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, did you test it with the giapi python client?
I guess the only open question is whether we should always start the stomp connector by default and also whether we want to have stomp-only gmps

int maxMessagesLimit,
int maxStorageMB) {
this.url = url;
this.stompUrl = stompUrl != null ? stompUrl : ConfigDefaults.BROKER_STOMP_URL;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implies that we always have a stomp broker, unlike the tcp broker which can be null and thus disabled. I only see that this could be a problem for tests, if they run in parallel they could conflict if passing null.

Should we allow nulls to signal not starting the stomp broker?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, agreed. A missing or empty stompUrl now means no STOMP connector: the builder defaults to null and the component no longer falls back to a default URL. The default ActiveMQBrokerComponent-default.cfg still sets stompUrl=stomp+nio://0.0.0.0:61613, so a standard GMP keeps STOMP, while tests and instances without the property don't open port 61613.

public static final String BROKER_MAX_MESSAGES_LIMIT_PROPERTY = "maxMessagesLimit";

private static final int BROKER_PORT = 61616;
private static final int BROKER_STOMP_PORT = 61613;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the standard stomp port? It is not really important

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, 61613 is ActiveMQ's default STOMP port

public HandlerResponse buildResponse(Message reply) throws JMSException {
// The null check below prevents timed-out APPLY replies from failing with a
// NullPointerException. When the instrument does not answer, GMP should return
// NOANSWER; otherwise the unresolved gateway command may be reprocessed.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOANSWER should be what happens when there is a timeout. This fix is valid and consistent with the rest of the checks but the comment about timed-out seems incorrect

@framos-dev framos-dev Nov 12, 2026 •
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. A NOANSWER on timeout is the existing behaviour, the comment was misleading. I've reworded the comment.

managementContext.setConnectorPort(builder.jmxConnectorPort);
_broker.setManagementContext(managementContext);
}
addConnector(builder.url);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i suppose we should also check if builder.url is null, Would we want to ever run a stomp only broker?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the original code it wasn't checked either :)

Regarding a STOMP-only broker, I don't think we want one. giapi-tester and the C++ giapi-glue connect through OpenWire on 61616, so that connector has to stay. A null brokerUrl already failed at startup, but with an unclear error, so I've added an explicit check with a clear message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0