Skip to content

Commit

Permalink
ARTEMIS-4575 Only start the consumers that were added
Browse files Browse the repository at this point in the history
Change from forcing a session start cycle on each consumer add
event and start only those consumers that were added which will
trigger a prompt delivery action on each. The session should be
marked started on create to account for the remove of the start
on each consumer add event.
  • Loading branch information
tabish121 authored and jbertram committed Jan 22, 2024
1 parent a70c421 commit 54f5dae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ public void addConsumer(ConsumerInfo info) throws Exception {
return;
}

amqSession.start();
consumersList.forEach((c) -> c.start());

if (AdvisorySupport.isAdvisoryTopic(info.getDestination())) {
//advisory for temp destinations
Expand Down Expand Up @@ -1122,6 +1122,7 @@ public void addSessions(Set<SessionId> sessionSet) {
public AMQSession addSession(SessionInfo ss) {
AMQSession amqSession = new AMQSession(getState().getInfo(), ss, server, this, protocolManager, coreMessageObjectPools);
amqSession.initialize();
amqSession.start();

sessions.put(ss.getSessionId(), amqSession);
sessionIdMap.put(amqSession.getCoreSession().getName(), ss.getSessionId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ private static String convertOpenWireToActiveMQFilterString(final String selecto
return filterString;
}

public void start() {
if (serverConsumer == null) {
throw new IllegalStateException("Cannot start the AMQConsumer until it has been initialized");
}

serverConsumer.setStarted(true);
}

public void init(SlowConsumerDetectionListener slowConsumerDetectionListener, long nativeId) throws Exception {

SimpleString selector = info.getSelector() == null ? null : new SimpleString(convertOpenWireToActiveMQFilterString(info.getSelector()));
Expand Down

0 comments on commit 54f5dae

Please sign in to comment.