mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
add kafka producer
This commit is contained in:
parent
b5ccc35340
commit
abb5c5ad31
12 changed files with 185 additions and 2 deletions
|
@ -49,6 +49,7 @@ using namespace std;
|
|||
#include <srs_app_caster_flv.hpp>
|
||||
#include <srs_core_mem_watch.hpp>
|
||||
#include <srs_kernel_consts.hpp>
|
||||
#include <srs_app_kafka.hpp>
|
||||
|
||||
// system interval in ms,
|
||||
// all resolution times should be times togother,
|
||||
|
@ -508,6 +509,7 @@ SrsServer::SrsServer()
|
|||
#ifdef SRS_AUTO_INGEST
|
||||
ingester = NULL;
|
||||
#endif
|
||||
kafka = new SrsKafkaProducer();
|
||||
}
|
||||
|
||||
SrsServer::~SrsServer()
|
||||
|
@ -537,6 +539,8 @@ void SrsServer::destroy()
|
|||
srs_freep(ingester);
|
||||
#endif
|
||||
|
||||
srs_freep(kafka);
|
||||
|
||||
if (pid_fd > 0) {
|
||||
::close(pid_fd);
|
||||
pid_fd = -1;
|
||||
|
@ -561,6 +565,8 @@ void SrsServer::dispose()
|
|||
ingester->dispose();
|
||||
#endif
|
||||
|
||||
kafka->stop();
|
||||
|
||||
SrsSource::dispose_all();
|
||||
|
||||
while (!conns.empty()) {
|
||||
|
@ -864,6 +870,18 @@ int SrsServer::ingest()
|
|||
return ret;
|
||||
}
|
||||
|
||||
int SrsServer::start_kafka()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
if ((ret = kafka->initialize()) != ERROR_SUCCESS) {
|
||||
srs_error("initialize the kafka producer failed. ret=%d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return kafka->start();
|
||||
}
|
||||
|
||||
int SrsServer::cycle()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue