Skip to content

Commit

Permalink
Add node column to list_stream_publishers/consumers
Browse files Browse the repository at this point in the history
Fixes #9582

(cherry picked from commit db65caa)
  • Loading branch information
acogoluegnes authored and mergify[bot] committed Sep 30, 2023
1 parent 9bbb95b commit d1640af
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
%% The Original Code is RabbitMQ.
%%
%% The Initial Developer of the Original Code is GoPivotal, Inc.
%% Copyright (c) 2021 VMware, Inc. or its affiliates. All rights reserved.
%% Copyright (c) 2021-2023 VMware, Inc. or its affiliates. All rights reserved.

-module('Elixir.RabbitMQ.CLI.Ctl.Commands.ListStreamConsumersCommand').

Expand Down Expand Up @@ -65,7 +65,7 @@ validate(Args, _) ->

merge_defaults([], Opts) ->
merge_defaults([rabbit_data_coercion:to_binary(Item)
|| Item <- ?CONSUMER_INFO_ITEMS],
|| Item <- ?CONSUMER_INFO_ITEMS -- [connection_pid, node]],
Opts);
merge_defaults(Args, Opts) ->
{Args, maps:merge(#{verbose => false, vhost => <<"/">>}, Opts)}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
%% The Original Code is RabbitMQ.
%%
%% The Initial Developer of the Original Code is GoPivotal, Inc.
%% Copyright (c) 2021 VMware, Inc. or its affiliates. All rights reserved.
%% Copyright (c) 2021-2023 VMware, Inc. or its affiliates. All rights reserved.

-module('Elixir.RabbitMQ.CLI.Ctl.Commands.ListStreamPublishersCommand').

Expand Down Expand Up @@ -65,7 +65,7 @@ validate(Args, _) ->

merge_defaults([], Opts) ->
merge_defaults([rabbit_data_coercion:to_binary(Item)
|| Item <- ?PUBLISHER_INFO_ITEMS],
|| Item <- ?PUBLISHER_INFO_ITEMS -- [connection_pid, node]],
Opts);
merge_defaults(Args, Opts) ->
{Args, maps:merge(#{verbose => false, vhost => <<"/">>}, Opts)}.
Expand Down
4 changes: 4 additions & 0 deletions deps/rabbitmq_stream/src/rabbit_stream_reader.erl
Original file line number Diff line number Diff line change
Expand Up @@ -3621,6 +3621,8 @@ consumer_i(offset_lag,
stream_stored_offset(Log) - consumer_offset(Counters);
consumer_i(connection_pid, _) ->
self();
consumer_i(node, _) ->
node();
consumer_i(properties,
#consumer{configuration =
#consumer_configuration{properties = Properties}}) ->
Expand Down Expand Up @@ -3653,6 +3655,8 @@ publisher_i(stream, #publisher{stream = S}) ->
S;
publisher_i(connection_pid, _) ->
self();
publisher_i(node, _) ->
node();
publisher_i(publisher_id, #publisher{publisher_id = Id}) ->
Id;
publisher_i(reference, #publisher{reference = undefined}) ->
Expand Down
4 changes: 2 additions & 2 deletions deps/rabbitmq_stream/test/commands_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ list_tls_connections_run(Config) ->
list_consumers_merge_defaults(_Config) ->
DefaultItems =
[rabbit_data_coercion:to_binary(Item)
|| Item <- ?CONSUMER_INFO_ITEMS],
|| Item <- ?CONSUMER_INFO_ITEMS -- [connection_pid, node]],
{DefaultItems, #{verbose := false}} =
?COMMAND_LIST_CONSUMERS:merge_defaults([], #{}),

Expand Down Expand Up @@ -266,7 +266,7 @@ list_consumers_run(Config) ->
list_publishers_merge_defaults(_Config) ->
DefaultItems =
[rabbit_data_coercion:to_binary(Item)
|| Item <- ?PUBLISHER_INFO_ITEMS],
|| Item <- ?PUBLISHER_INFO_ITEMS -- [connection_pid, node]],
{DefaultItems, #{verbose := false}} =
?COMMAND_LIST_PUBLISHERS:merge_defaults([], #{}),

Expand Down
2 changes: 2 additions & 0 deletions deps/rabbitmq_stream_common/include/rabbit_stream.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@

-define(CONSUMER_INFO_ITEMS, [
connection_pid,
node,
subscription_id,
stream,
messages_consumed,
Expand All @@ -108,6 +109,7 @@

-define(PUBLISHER_INFO_ITEMS, [
connection_pid,
node,
publisher_id,
stream,
reference,
Expand Down

0 comments on commit d1640af

Please sign in to comment.