Skip to content

Commit

Permalink
Merge pull request #89 from nasark/close_rdkafka_admin_client_connection
Browse files Browse the repository at this point in the history
Close Kafka admin client connection
  • Loading branch information
agrare committed May 3, 2024
2 parents 0fd700a + d784d26 commit f41e17b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/manageiq/messaging/kafka/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def ack(ack_ref)
end

def close
@admin&.close
@admin = nil

@producer&.close
@producer = nil

Expand All @@ -65,7 +68,7 @@ def close

# list all topics
def topics
kafka_client.admin.metadata.topics.map { |topic| topic[:topic_name] }
admin.metadata.topics.map { |topic| topic[:topic_name] }
end

private
Expand Down
4 changes: 4 additions & 0 deletions lib/manageiq/messaging/kafka/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ module Common

private

def admin
@admin ||= kafka_client.admin
end

def producer
@producer ||= kafka_client.producer
end
Expand Down

0 comments on commit f41e17b

Please sign in to comment.