Unverified Commit 0ae7b3f8 authored by Stefan Siegl's avatar Stefan Siegl
Browse files

stuff.

parents
/vendor
composer.phar
{
"name": "stesie/hello-kafka-php",
"type": "project",
"require": {
"nmred/kafka-php": "v0.2.0.8",
"monolog/monolog": "^1.23"
},
"authors": [
{
"name": "Stefan Siegl",
"email": "stefan.siegl@mayflower.de"
}
]
}
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "703d5f068dc93160bddfee1e462d9b14",
"packages": [
{
"name": "amphp/amp",
"version": "v1.2.2",
"source": {
"type": "git",
"url": "https://github.com/amphp/amp.git",
"reference": "4f2161da5f68f274f116985635aea63b5c0f54d2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/amphp/amp/zipball/4f2161da5f68f274f116985635aea63b5c0f54d2",
"reference": "4f2161da5f68f274f116985635aea63b5c0f54d2",
"shasum": ""
},
"require": {
"php": ">=5.5"
},
"require-dev": {
"fabpot/php-cs-fixer": "~1.9",
"phpunit/phpunit": "~4.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Amp\\": "lib/"
},
"files": [
"lib/functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Daniel Lowrey",
"email": "rdlowrey@php.net",
"role": "Creator / Lead Developer"
}
],
"description": "A non-blocking concurrency framework for PHP applications",
"homepage": "https://github.com/amphp/amp",
"keywords": [
"async",
"concurrency",
"event",
"non-blocking",
"promise"
],
"time": "2016-05-12T12:54:59+00:00"
},
{
"name": "monolog/monolog",
"version": "1.23.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4",
"reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4",
"shasum": ""
},
"require": {
"php": ">=5.3.0",
"psr/log": "~1.0"
},
"provide": {
"psr/log-implementation": "1.0.0"
},
"require-dev": {
"aws/aws-sdk-php": "^2.4.9 || ^3.0",
"doctrine/couchdb": "~1.0@dev",
"graylog2/gelf-php": "~1.0",
"jakub-onderka/php-parallel-lint": "0.9",
"php-amqplib/php-amqplib": "~2.4",
"php-console/php-console": "^3.1.3",
"phpunit/phpunit": "~4.5",
"phpunit/phpunit-mock-objects": "2.3.0",
"ruflin/elastica": ">=0.90 <3.0",
"sentry/sentry": "^0.13",
"swiftmailer/swiftmailer": "^5.3|^6.0"
},
"suggest": {
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
"ext-mongo": "Allow sending log messages to a MongoDB server",
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
"mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver",
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
"php-console/php-console": "Allow sending log messages to Google Chrome",
"rollbar/rollbar": "Allow sending log messages to Rollbar",
"ruflin/elastica": "Allow sending log messages to an Elastic Search server",
"sentry/sentry": "Allow sending log messages to a Sentry server"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Monolog\\": "src/Monolog"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be"
}
],
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
"homepage": "http://github.com/Seldaek/monolog",
"keywords": [
"log",
"logging",
"psr-3"
],
"time": "2017-06-19T01:22:40+00:00"
},
{
"name": "nmred/kafka-php",
"version": "v0.2.0.8",
"source": {
"type": "git",
"url": "https://github.com/weiboad/kafka-php.git",
"reference": "d5b395aeb9d069dce49fc1dceff0a6f45750d981"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/weiboad/kafka-php/zipball/d5b395aeb9d069dce49fc1dceff0a6f45750d981",
"reference": "d5b395aeb9d069dce49fc1dceff0a6f45750d981",
"shasum": ""
},
"require": {
"amphp/amp": "v1.2.2",
"php": ">=5.5",
"psr/log": "1.0.2"
},
"require-dev": {
"kmelia/monolog-stdout-handler": "1.2.1",
"monolog/monolog": "1.22.1",
"phpunit/phpcov": "*",
"phpunit/phpunit": "~4.0",
"satooshi/php-coveralls": "dev-master"
},
"type": "library",
"autoload": {
"psr-0": {
"Kafka\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"description": "Kafka client for php",
"homepage": "http://www.swanlinux.net",
"keywords": [
"client",
"kafka"
],
"time": "2017-10-23T09:33:08+00:00"
},
{
"name": "psr/log",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Log\\": "Psr/Log/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
],
"time": "2016-10-10T12:19:37+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}
<?php
require 'vendor/autoload.php';
use Monolog\Handler\ErrorLogHandler;
use Monolog\Logger;
// Create the logger
$logger = new Logger('my_logger');
// Now add some handlers
$logger->pushHandler(new ErrorLogHandler(ErrorLogHandler::OPERATING_SYSTEM, Logger::INFO));
$config = \Kafka\ConsumerConfig::getInstance();
$config->setMetadataRefreshIntervalMs(10000);
$config->setMetadataBrokerList('172.19.0.2:9092');
$config->setGroupId('fnord');
//$config->setBrokerVersion('0.9.0.1');
$config->setTopics(array('testchen'));
//$config->setOffsetReset('earliest');
$consumer = new \Kafka\Consumer();
$consumer->setLogger($logger);
$consumer->start(function ($topic, $part, $message) {
var_dump($message);
});
\ No newline at end of file
<?php
require 'vendor/autoload.php';
use Monolog\Handler\ErrorLogHandler;
use Monolog\Logger;
// Create the logger
$logger = new Logger('my_logger');
// Now add some handlers
$logger->pushHandler(new ErrorLogHandler(ErrorLogHandler::OPERATING_SYSTEM, Logger::INFO));
$config = \Kafka\ProducerConfig::getInstance();
$config->setMetadataRefreshIntervalMs(10000);
$config->setMetadataBrokerList('172.19.0.2:9092');
//$config->setBrokerVersion('0.9.0.1');
//$config->setRequiredAck(1);
$config->setIsAsyn(false);
//$config->setProduceInterval(500);
$producer = new \Kafka\Producer();
$producer->setLogger($logger);
for (;;) {
$result = $producer->send(array(
array(
'topic' => 'testchen',
'value' => 'aktuelle Zeit: ' . date('Ymd-His'),
'key' => 'blub',
//'partId' => 2,
),
));
var_dump($result);
sleep(1);
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment