Skip to content

kshvakov/nats-streaming-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nats-streaming-proxy

Write to the NATS Streaming via Memcached protocol.

Why?

Because some script languages don't have a high performance NATS Streaming clients, but have a good Memcached client :)

Example PHP client with connection pool.

<?php
$mem = new Memcached('nats-streaming-connection-pool');
if (count($mem->getServerList()) == 0) {
    $mem->addServer("10.112.179.191", 11211);
    $mem->addServer("10.112.179.192", 11211);
    // http://php.net/manual/en/memcached.constants.php
    $mem->setOption(Memcached::OPT_TCP_NODELAY, true);  // On some installations the connection pool doesn't work without this option.
    $mem->setOption(Memcached::OPT_COMPRESSION, false); // if you don't want surprises with a transparent compression.
}
$mem->set('subject', json_encode([
    'event_time' => time(),
    'event_type' => 'type',
    'payload'    => 'XXXX'
]));

Grafana dashboard