Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
};
const sropt: SenderOptions = { target: { address: this.address } };
logger.verbose(
"[%s] Creating sender/receiver links on a session for $management endpoint with " +
"srOpts: %o, receiverOpts: %O.",
this._context.connectionId,
sropt,
rxopt
);
this._mgmtReqResLink = await RequestResponseLink.create(
this._context.connection,
sropt,
rxopt
);
this._mgmtReqResLink.sender.on(SenderEvents.senderError, (context: EventContext) => {
const id = context.connection.options.id;
const ehError = translate(context.sender!.error!);
logger.verbose("[%s] An error occurred on the $management sender link.. %O", id, ehError);
});
this._mgmtReqResLink.receiver.on(ReceiverEvents.receiverError, (context: EventContext) => {
const id = context.connection.options.id;
const ehError = translate(context.receiver!.error!);
logger.verbose(
"[%s] An error occurred on the $management receiver link.. %O",
id,
ehError
);
});
logger.verbose(
"[%s] Created sender '%s' and receiver '%s' links for $management endpoint.",
this._context.connectionId,
}
};
const sropt: SenderOptions = { target: { address: this.address } };
log.mgmt(
"[%s] Creating sender/receiver links on a session for $management endpoint with " +
"srOpts: %o, receiverOpts: %O.",
this._context.namespace.connectionId,
sropt,
rxopt
);
this._mgmtReqResLink = await RequestResponseLink.create(
this._context.namespace.connection,
sropt,
rxopt
);
this._mgmtReqResLink.sender.on(SenderEvents.senderError, (context: EventContext) => {
const id = context.connection.options.id;
const ehError = translate(context.sender!.error!);
log.error("[%s] An error occurred on the $management sender link.. %O", id, ehError);
});
this._mgmtReqResLink.receiver.on(ReceiverEvents.receiverError, (context: EventContext) => {
const id = context.connection.options.id;
const ehError = translate(context.receiver!.error!);
log.error("[%s] An error occurred on the $management receiver link.. %O", id, ehError);
});
log.mgmt(
"[%s] Created sender '%s' and receiver '%s' links for $management endpoint.",
this._context.namespace.connectionId,
this._mgmtReqResLink.sender.name,
this._mgmtReqResLink.receiver.name
);
await this._ensureTokenRenewal();
id,
ehError
);
}
};
const srOpt: SenderOptions = { target: { address: this.endpoint } };
logger.verbose(
"[%s] Creating sender/receiver links on a session for $cbs endpoint.",
this.connection.id
);
this._cbsSenderReceiverLink = await RequestResponseLink.create(
this.connection,
srOpt,
rxOpt
);
this._cbsSenderReceiverLink.sender.on(SenderEvents.senderError, (context: EventContext) => {
const id = context.connection.options.id;
const ehError = translate(context.sender!.error!);
logger.verbose("[%s] An error occurred on the cbs sender link.. %O", id, ehError);
});
this._cbsSenderReceiverLink.receiver.on(
ReceiverEvents.receiverError,
(context: EventContext) => {
const id = context.connection.options.id;
const ehError = translate(context.receiver!.error!);
logger.verbose("[%s] An error occurred on the cbs receiver link.. %O", id, ehError);
}
);
logger.verbose(
"[%s] Successfully created the cbs sender '%s' and receiver '%s' " +
"links over cbs session.",
this.connection.id,