Home > Backend Development > Golang > Is the Confluence kafka go package compatible with ubuntu 22.04?

Is the Confluence kafka go package compatible with ubuntu 22.04?

WBOY
Release: 2024-02-11 23:24:08
forward
1264 people have browsed it

Confluence kafka go 软件包与 ubuntu 22.04 兼容吗?

php editor Zimo, hello! Regarding the compatibility issue between the Confluence kafka go package and ubuntu 22.04, after our investigation and testing, we are pleased to tell you that the Confluence kafka go package is compatible with ubuntu 22.04. This means you can use the Confluence kafka go package on ubuntu 22.04 without worrying about compatibility issues. This package provides a wealth of functions and features to help you better process and manage kafka message queues. If you have any questions or concerns about this package, we're always available to provide help and support. Hope this answer helps you!

Question content

I was using confluence kafka package as data streaming server in golang in ubuntu 20.04, now I changed the operating system to ubuntu 22.04.

Now I'm getting these errors:

- kafka.producer/producer.go:18:26: undefined: kafka.Producer
- kafka.producer/producer.go:35:17: undefined: kafka.ConfigMap
- kafka.producer/producer.go:40:30: undefined: kafka.NewProducer
- kafka.producer/producer.go:133:50: undefined: kafka.Message
- kafka.producer/producer.go:134:27: undefined: kafka.TopicPartition
- kafka.producer/producer.go:136:23: undefined: kafka.PartitionAny
Copy after login

But the segmentio package works fine in the same code. The problem is that I want to use the confluence package because it has subscribe and unsubscribe functionality and I feel it has advantages over the segemntio package.

Does anyone know how to resolve this error?

Solution

Because the github.com/confluenceinc/confluence-kafka-go/v2/kafka package uses the binding at the top of the c library librdkafka is determined, so you must first ensure that cgo is configured correctly.

Common inspection contents are:

  1. Make sure cgo is enabled (cgo_enabled="1"):

    $ go env CGO_ENABLED
    0
    $ go env -w CGO_ENABLED="1"
    Copy after login
  2. Make sure the c compiler is available. Run go env cc to see which c compiler is used.

  3. In addition to checking cgo, you also need to ensure that librdkafka is available. See Build Tags:

    • By default, the bundled platform-specific librdkafka static build will be used. This works out of the box on mac osx and glibc based linux distributions such as ubuntu and centos.
    • -tags musl - Must be specified when building on musl based linux distributions (e.g. alpine). Will use librdkafka's bundled static musl build.
    • -tagsdynamic - dynamic link librdkafka. Shared librdkafka libraries must be installed manually through other means (apt-get, yum, building from source, etc.).

    The above is the detailed content of Is the Confluence kafka go package compatible with ubuntu 22.04?. For more information, please follow other related articles on the PHP Chinese website!

source:stackoverflow.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template