Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In order to send and read user json data through kafka, #3

Open
b1ueseanoah opened this issue Nov 22, 2023 · 1 comment
Open

In order to send and read user json data through kafka, #3

b1ueseanoah opened this issue Nov 22, 2023 · 1 comment

Comments

@b1ueseanoah
Copy link
Collaborator

In order to send and read user json data through kafka,
we will change the source that sets consumer and producer of kafka.

@b1ueseanoah
Copy link
Collaborator Author

we changed the source code that sets consumer and producer of gedge kafka.

def set_producer(self):
    self.producer= KafkaProducer(acks=0, 
                compression_type='gzip', 
                bootstrap_servers=self.bootstrap_servers, 
                value_serializer=lambda x: json.dumps(x).encode('utf-8')) 

def set_consumer(self, topic_name, groupId):    
    self.consumer = KafkaConsumer(
            topic_name,
            bootstrap_servers   = self.bootstrap_servers, 
            group_id            = groupId,
            #enable_auto_commit  = True,
            enable_auto_commit  = False,
            auto_offset_reset   = 'earliest',
            value_deserializer  = lambda x: json.loads(x.decode('utf-8')), 
            consumer_timeout_ms = gDefine.CONSUMER_TIMEOUT_MS_TIME
        )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant