Repository navigation
Support to STOMP - #88
framos-dev wants to merge 2 commits into
Conversation
|
Tick the box to add this pull request to the merge queue (same as
|
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Is this the standard stomp port? It is not really important
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
i suppose we should also check if builder.url is null, Would we want to ever run a stomp only broker?
There was a problem hiding this comment.
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.
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
stompUrlproperty, defaultstomp+nio://0.0.0.0:61613. Configs without it fall back to the default.xstreamandjettison, which the STOMPjms-map-jsontransformation needs for giapi-python commands. Both are included in thegmp-serverdistribution.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 (nullreply) returned by the instrument no longer throws aNullPointerException; it returnsNOANSWER. Replies that aren't MapMessages are now read from theGMP_HANDLER_RESPONSEheaders, and an invalid value returnsNOANSWER.