Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

amqp-heartbeat

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amqp-heartbeat - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

60

index.js

@@ -10,3 +10,3 @@ var amqp = require( 'amqplib/callback_api' )

status : '',
mqConn : null
mqChannel : null
}

@@ -21,5 +21,5 @@

mqConnect(
function ( err, conn ) {
function ( err, ch ) {
if ( ! err ) {
heartbeat.mqConn = conn
heartbeat.mqChannel = ch
setInterval( amqpHeartbeat, timerInterval )

@@ -40,6 +40,17 @@ log.info( 'amqp-heartbeat', 'Started.' )

if ( err != null ) {
log.error( 'amqp-heartbeat', err ); process.exit(1)
log.error( 'amqp-heartbeat', err )
callback( err, null )
} else {
conn.createChannel(
function( err, ch ) {
if ( err != null ) {
log.error( 'amqp-heartbeat', err )
callback( err, null )
} else {
//log.info( 'amqp-heartbeat', 'connected to '+heartbeat.rabbitMqURL )
callback( err, ch )
}
}
)
}
//log.info( 'amqp-heartbeat', 'connected to '+heartbeat.rabbitMqURL )
callback( err, conn )
}

@@ -51,25 +62,16 @@ )

//log.info( 'amqp-heartbeat', 'start with '+heartbeat.rabbitMqURL )
heartbeat.mqConn.createChannel(
function( err, ch ) {
if ( err != null ) {
log.error( 'amqp-heartbeat', err ); process.exit(1)
}
var host = 'unknown'
if ( process.env['HOSTNAME'] ) host = process.env['HOSTNAME']
var heartbeatMsg =
{
serviceName: heartbeat.serviceName,
serviceID: heartbeat.serviceID,
heartbeatTime: Date.now(),
host: host,
status: heartbeat.status
}
var msg = JSON.stringify( heartbeatMsg )
ch.assertExchange( 'heartbeats', 'topic', { durable : false } );
ch.publish( 'heartbeats', 'dashboard.collector', new Buffer( msg ) )
//log.info( 'amqp-heartbeat' + msg );
}
)
var host = 'unknown'
if ( process.env['HOSTNAME'] ) host = process.env['HOSTNAME']
var heartbeatMsg =
{
serviceName: heartbeat.serviceName,
serviceID: heartbeat.serviceID,
heartbeatTime: Date.now(),
host: host,
status: heartbeat.status
}
var msg = JSON.stringify( heartbeatMsg )
heartbeat.mqChannel.assertExchange( 'heartbeats', 'topic', { durable : false } )
heartbeat.mqChannel.publish( 'heartbeats', 'dashboard.collector', new Buffer( msg ) )
//log.info( 'amqp-heartbeat' + msg );
}
{
"name":"amqp-heartbeat",
"version":"1.2.0",
"version":"1.3.0",
"description":"Send heartbeat messages to RabbitMQ",

@@ -5,0 +5,0 @@ "author":"ma-ha",

var heartbeat = require ( '../' ) // stand alone: replace with require( 'amqp-heartbeat' )
heartbeat.setStatus( 'ohhh -- started' )
heartbeat.setStatus( 'some message' )
heartbeat.start( 'amqp://user:password@localhost', 'Some Service Name' )
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc