Comments (10)
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
from laravel-kafka.
@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.
@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.
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.
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.
@mateusjunges It's working fine now, thanks!
from laravel-kafka.
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.
@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.
@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.
@dilip-E2 i'm using version 1.2.1 on ubuntu 20.04.3 at this moment.
from laravel-kafka.
Related Issues (20)
- Failed to resolve `broker:9092` HOT 4
- Getting a timeout issue, while trying to publish a message. HOT 7
- Undefined constant \"Junges\\Kafka\\RD_KAFKA_PARTITION_UA\ HOT 3
- Upstash Support - Producer not sending messages. HOT 3
- Wrong return type in Junges\Kafka\Config\Config->getCommit HOT 2
- Cannot Consume published messages in laravel 11 and php 8.3.6 HOT 15
- Issue consuming records from Avro topic HOT 1
- Cannot consume produced messages in v2.0 HOT 2
- What do we need to set for the `--consumer` flag. HOT 1
- Message consuming is still an issue in v2.1 HOT 10
- Encoded payloads: Is it possible with Avro Serializer to Save encoded messages in Kafka when sending it using AvroSerialize and doing the opposite when reading with Deserializer HOT 1
- Is there any support to Retry policies ? HOT 2
- [QUESTION] Possibility to describe topic / calculate read backlog HOT 1
- [Question/bug] Consuming Tombstones and send it to dlq throws $payload must be of type string, null given HOT 1
- cant send message HOT 8
- Error "Specified group generation id is not valid" during consumption HOT 3
- How to commit each message in withHandler HOT 1
- Missing messages HOT 2
- Customizable flush retried and timeout
- stopAfterLastMessage not working as expected. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-kafka.