Repository: robooo/robotframework-ConfluentKafkaLibrary (language: python)

Issue:
ValueError: Consumer or producer group_id is wrong or does not exists!
Running with 2.0.2-3, and trying to check that a topic exists in a given threaded consumer.
We are using Get Thread Group Id and this is returning a value from our threads.  e.g. 

```
Arguments: [ <GetMessagesThread(Thread-2, started daemon 140414778578624)> ]
Return: 'beb1aba9-056e-4877-aca8-403da54b2e4a'
${telemetry_group_id} = beb1aba9-056e-4877-aca8-403da54b2e4a
```

However, when trying to use this with ```List Topics    ${telemetry_group_id}    abc.network.telemetry``` we receive the following output.

```
ValueError: Consumer or producer group_id is wrong or does not exists!	
18:09:04.950	DEBUG	Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/ConfluentKafkaLibrary/__init__.py", line 118, in list_topics
    raise ValueError('Consumer or producer group_id is wrong or does not exists!')
ValueError: Consumer or producer group_id is wrong or does not exists!
```

I'm not sure if this is expected behaviour or not, as I can see that threaded consumer group id  is not added to consumers.  So perhaps this is expected, although it would be useful if it were possible to leverage the thread group id for this type of task rather than having to make another consumer just for the purpose of getting topic lists etc.


Discussion / hints:
Hi @andyjsharp,
why do you exactly using `List Topics    ${telemetry_group_id}    abc.network.telemetry` instead of just `List Topics    ${telemetry_group_id}` ? 
I can do some testing this weekend and will get back to you
@robooo : I just wanted to make sure that a specific topic was present, rather than get all the topics back.  If that makes any sense..?  No rush, don't spoil your w/end just for this.  It's just an observation, not really blocking me on this particular project.

Fix patch:
diff --git a/src/ConfluentKafkaLibrary/consumer.py b/src/ConfluentKafkaLibrary/consumer.py
index 69e65e4..c84e853 100644
--- a/src/ConfluentKafkaLibrary/consumer.py
+++ b/src/ConfluentKafkaLibrary/consumer.py
@@ -352,6 +352,8 @@ def start_consumer_threaded(
             raise ValueError("Topics can not be empty!")
 
         consumer_thread = GetMessagesThread(server, port, topics, group_id=group_id, only_value=only_value, **kwargs)
+        group_id = consumer_thread.group_id
+        self.consumers[group_id] = consumer_thread.consumer.consumers[group_id]
         return consumer_thread
 
     def get_messages_from_thread(self, running_thread, decode_format=None):


Test patch:
diff --git a/examples/test.robot b/examples/test.robot
index f81961d..3b3c54b 100644
--- a/examples/test.robot
+++ b/examples/test.robot
@@ -10,6 +10,9 @@ Verify Topics
     ${group_id}=  Create Consumer  auto_offset_reset=earliest
     ${topics}=  List Topics  ${group_id}
     Dictionary Should Contain Key  ${topics}  ${TEST_TOPIC}
+
+    ${topics_thread}=  List Topics  ${THREADED_GROUPID}
+    Dictionary Should Contain Key  ${topics}  ${TEST_TOPIC}
     [Teardown]  Close Consumer  ${group_id}
 
 Basic Consumer
@@ -152,6 +155,7 @@ Starting Test
     ${thread}=  Start Consumer Threaded  topics=${TEST_TOPIC}
     ${gid}=  Get Thread Group Id  ${thread}
     Log  ${gid}
+    Set Suite Variable  ${THREADED_GROUPID}  ${gid}
     Set Suite Variable  ${MAIN_THREAD}  ${thread}
     ${producer_group_id}=  Create Producer
     Set Suite Variable  ${PRODUCER_ID}  ${producer_group_id}