Giter VIP home page Giter VIP logo

Comments (10)

mateusjunges avatar mateusjunges commented on August 21, 2024

Hi @dilip-E2
can you show me your code? I cant reproduce in a fresh laravel installation. Here is my working example:

My ProducerController:

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Junges\Kafka\Facades\Kafka;

class ProducerController
{
    public function __invoke()
    {
        Kafka::publishOn('localhost:9092', 'test_topic')
            ->withBodyKey('foo', 'bar')
            ->send();

        return response('ok');
    }
}

Routes:

Route::get('produce', \App\Http\Controllers\ProducerController::class);

And this is the published message
Screenshot from 2021-10-30 00-08-02

from laravel-kafka.

elgibor-solution avatar elgibor-solution commented on August 21, 2024

@mateusjunges I also get same issue, below are my code

function publishMessage($type, $data, $whereQuery=false) {

    $headers = [
        "emr_service_id" => $this->tenantId,
        'user_id' => $this->user->id,
        'tenant_id' => $this->tenantId,
        'phone' => $this->user->phone,
        'message_type' => "TRANSACTION",
        'transaction_type' => $type
    ];

    $body = [
        "transaction_id" => uniqid(),
        "db_name" => \DB::connection()->getDatabaseName(),
        "table" => "es_patients",
        "data" => $data
    ];

    if ($whereQuery) {
        $body["where_query"] = $whereQuery;
    }

    $message = new Message($this->kafkaTopic, 0, $headers, $body);

    $producer = Kafka::publishOn('broker', $this->kafkaTopic)
                    ->withMessage($message)
                    ->send();

    $producer->send();
}

from laravel-kafka.

mateusjunges avatar mateusjunges commented on August 21, 2024

@elgibor-solution your code will throw an error because you are calling send on bool here:

$producer->send()

You already called send() here:

Kafka::publishOn('broker', $this->kafkaTopic)
    ->withMessage($message)
    ->send()

You don't need to calll send twice.

Also, i still can't reproduce the Call to undefined method RdKafka\ProducerTopic::producev() error.

from laravel-kafka.

elgibor-solution avatar elgibor-solution commented on August 21, 2024

@mateusjunges

please ignore the last "send", it's because i do debug.

The Call to undefined method RdKafka\ProducerTopic::producev() issue occured because the librdkafka version is under 0.11.4, i upgrade the version and the issue resolved.

from laravel-kafka.

mateusjunges avatar mateusjunges commented on August 21, 2024

Hi @elgibor-solution, is it working fine right now? Anything i can help you with?
@dilip-E2 let me know if @elgibor-solution solution works out for you.

from laravel-kafka.

elgibor-solution avatar elgibor-solution commented on August 21, 2024

@mateusjunges It's working fine now, thanks!

from laravel-kafka.

mateusjunges avatar mateusjunges commented on August 21, 2024

Ok. @dilip-E2 i'm closing this assuming @elgibor-solution solutions solves your problem. Feel free to reopen this or create another one if you are still experiencing issues.

from laravel-kafka.

dilip-E2 avatar dilip-E2 commented on August 21, 2024

@mateusjunges @elgibor-solution thanks for suppoert.

Below is my ubantu version
Ubuntu 18.04.6 LTS

When i am trying to upgrade librdkafka it is giving me the latest version as 0.11.3, so is there any Ubantu version dependency for librdkafka 0.11.4?

Can you please help me to upgrade librdkafka to 0.11.4?

Below is my librdkafka-dev information

$ sudo apt show librdkafka-dev
Package: librdkafka-dev
Version: 0.11.3-1build1
Priority: optional
Section: universe/libdevel
Source: librdkafka
Origin: Ubuntu
Maintainer: Ubuntu Developers [email protected]
Original-Maintainer: Faidon Liambotis [email protected]
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 2,113 kB
Depends: librdkafka++1 (= 0.11.3-1build1), librdkafka1 (= 0.11.3-1build1)
Homepage: https://github.com/edenhill/librdkafka
Download-Size: 387 kB

Thanks,
Dilip

from laravel-kafka.

elgibor-solution avatar elgibor-solution commented on August 21, 2024

@mateusjunges @elgibor-solution thanks for suppoert.

Below is my ubantu version Ubuntu 18.04.6 LTS

When i am trying to upgrade librdkafka it is giving me the latest version as 0.11.3, so is there any Ubantu version dependency for librdkafka 0.11.4?

Can you please help me to upgrade librdkafka to 0.11.4?

Below is my librdkafka-dev information

$ sudo apt show librdkafka-dev Package: librdkafka-dev Version: 0.11.3-1build1 Priority: optional Section: universe/libdevel Source: librdkafka Origin: Ubuntu Maintainer: Ubuntu Developers [email protected] Original-Maintainer: Faidon Liambotis [email protected] Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 2,113 kB Depends: librdkafka++1 (= 0.11.3-1build1), librdkafka1 (= 0.11.3-1build1) Homepage: https://github.com/edenhill/librdkafka Download-Size: 387 kB

Thanks, Dilip

@dilip-E2 I update the ubuntu into 20.04 to resolve that

from laravel-kafka.

mateusjunges avatar mateusjunges commented on August 21, 2024

@dilip-E2 i'm using version 1.2.1 on ubuntu 20.04.3 at this moment.

from laravel-kafka.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.