refactored
This commit is contained in:
parent
b8a305ec57
commit
9ef3445b77
@ -14,7 +14,7 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
service-type: "TB_SERVICE_TYPE" #kafka (Apache Kafka) or aws-sqs (AWS SQS) or pubsub (PubSub) or service-bus (Azure Service Bus) or rabbitmq (RabbitMQ)
|
||||
queue_type: "TB_QUEUE_TYPE" #kafka (Apache Kafka) or aws-sqs (AWS SQS) or pubsub (PubSub) or service-bus (Azure Service Bus) or rabbitmq (RabbitMQ)
|
||||
request_topic: "REMOTE_JS_EVAL_REQUEST_TOPIC"
|
||||
|
||||
js:
|
||||
@ -25,18 +25,18 @@ kafka:
|
||||
# Kafka Bootstrap Servers
|
||||
servers: "TB_KAFKA_SERVERS"
|
||||
replication_factor: "TB_QUEUE_KAFKA_REPLICATION_FACTOR"
|
||||
topic-properties: "TB_QUEUE_KAFKA_JE_TOPIC_PROPERTIES"
|
||||
topic_properties: "TB_QUEUE_KAFKA_JE_TOPIC_PROPERTIES"
|
||||
|
||||
pubsub:
|
||||
project_id: "TB_QUEUE_PUBSUB_PROJECT_ID"
|
||||
service_account: "TB_QUEUE_PUBSUB_SERVICE_ACCOUNT"
|
||||
queue-properties: "TB_QUEUE_PUBSUB_JE_QUEUE_PROPERTIES"
|
||||
queue_properties: "TB_QUEUE_PUBSUB_JE_QUEUE_PROPERTIES"
|
||||
|
||||
aws_sqs:
|
||||
access_key_id: "TB_QUEUE_AWS_SQS_ACCESS_KEY_ID"
|
||||
secret_access_key: "TB_QUEUE_AWS_SQS_SECRET_ACCESS_KEY"
|
||||
region: "TB_QUEUE_AWS_SQS_REGION"
|
||||
queue-properties: "TB_QUEUE_AWS_SQS_JE_QUEUE_PROPERTIES"
|
||||
queue_properties: "TB_QUEUE_AWS_SQS_JE_QUEUE_PROPERTIES"
|
||||
|
||||
rabbitmq:
|
||||
host: "TB_QUEUE_RABBIT_MQ_HOST"
|
||||
@ -44,14 +44,14 @@ rabbitmq:
|
||||
virtual_host: "TB_QUEUE_RABBIT_MQ_VIRTUAL_HOST"
|
||||
username: "TB_QUEUE_RABBIT_MQ_USERNAME"
|
||||
password: "TB_QUEUE_RABBIT_MQ_PASSWORD"
|
||||
queue-properties: "TB_QUEUE_RABBIT_MQ_JE_QUEUE_PROPERTIES"
|
||||
queue_properties: "TB_QUEUE_RABBIT_MQ_JE_QUEUE_PROPERTIES"
|
||||
|
||||
service_bus:
|
||||
namespace_name: "TB_QUEUE_SERVICE_BUS_NAMESPACE_NAME"
|
||||
sas_key_name: "TB_QUEUE_SERVICE_BUS_SAS_KEY_NAME"
|
||||
sas_key: "TB_QUEUE_SERVICE_BUS_SAS_KEY"
|
||||
max_messages: "TB_QUEUE_SERVICE_BUS_MAX_MESSAGES"
|
||||
queue-properties: "TB_QUEUE_SERVICE_BUS_JE_QUEUE_PROPERTIES"
|
||||
queue_properties: "TB_QUEUE_SERVICE_BUS_JE_QUEUE_PROPERTIES"
|
||||
|
||||
logger:
|
||||
level: "LOGGER_LEVEL"
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
service-type: "kafka"
|
||||
queue_type: "kafka"
|
||||
request_topic: "js_eval.requests"
|
||||
|
||||
js:
|
||||
@ -25,13 +25,13 @@ kafka:
|
||||
# Kafka Bootstrap Servers
|
||||
servers: "localhost:9092"
|
||||
replication_factor: "1"
|
||||
topic-properties: "retention.ms:604800000;segment.bytes:26214400;retention.bytes:104857600"
|
||||
topic_properties: "retention.ms:604800000;segment.bytes:26214400;retention.bytes:104857600"
|
||||
|
||||
pubsub:
|
||||
queue-properties: "ackDeadlineInSec:30;messageRetentionInSec:604800"
|
||||
queue_properties: "ackDeadlineInSec:30;messageRetentionInSec:604800"
|
||||
|
||||
aws_sqs:
|
||||
queue-properties: "VisibilityTimeout:30;MaximumMessageSize:262144;MessageRetentionPeriod:604800"
|
||||
queue_properties: "VisibilityTimeout:30;MaximumMessageSize:262144;MessageRetentionPeriod:604800"
|
||||
|
||||
rabbitmq:
|
||||
host: "localhost"
|
||||
@ -39,10 +39,10 @@ rabbitmq:
|
||||
virtual_host: "/"
|
||||
username: "admin"
|
||||
password: "password"
|
||||
queue-properties: "x-max-length-bytes:1048576000;x-message-ttl:604800000"
|
||||
queue_properties: "x-max-length-bytes:1048576000;x-message-ttl:604800000"
|
||||
|
||||
service_bus:
|
||||
queue-properties: "lockDurationInSec:30;maxSizeInMb:1024;messageTimeToLiveInSec:604800"
|
||||
queue_properties: "lockDurationInSec:30;maxSizeInMb:1024;messageTimeToLiveInSec:604800"
|
||||
|
||||
logger:
|
||||
level: "info"
|
||||
|
||||
@ -26,7 +26,7 @@ const accessKeyId = config.get('aws_sqs.access_key_id');
|
||||
const secretAccessKey = config.get('aws_sqs.secret_access_key');
|
||||
const region = config.get('aws_sqs.region');
|
||||
const AWS = require('aws-sdk');
|
||||
const queueProperties = config.get('aws_sqs.queue-properties');
|
||||
const queueProperties = config.get('aws_sqs.queue_properties');
|
||||
const poolInterval = config.get('js.response_poll_interval');
|
||||
|
||||
let queueAttributes = {FifoQueue: 'true', ContentBasedDeduplication: 'true'};
|
||||
|
||||
@ -20,7 +20,7 @@ const config = require('config'),
|
||||
logger = require('../config/logger')._logger('kafkaTemplate'),
|
||||
KafkaJsWinstonLogCreator = require('../config/logger').KafkaJsWinstonLogCreator;
|
||||
const replicationFactor = config.get('kafka.replication_factor');
|
||||
const topicProperties = config.get('kafka.topic-properties');
|
||||
const topicProperties = config.get('kafka.topic_properties');
|
||||
|
||||
let kafkaClient;
|
||||
let kafkaAdmin;
|
||||
|
||||
@ -24,7 +24,7 @@ const {PubSub} = require('@google-cloud/pubsub');
|
||||
const projectId = config.get('pubsub.project_id');
|
||||
const credentials = JSON.parse(config.get('pubsub.service_account'));
|
||||
const requestTopic = config.get('request_topic');
|
||||
const queueProperties = config.get('pubsub.queue-properties');
|
||||
const queueProperties = config.get('pubsub.queue_properties');
|
||||
|
||||
let pubSubClient;
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ const port = config.get('rabbitmq.port');
|
||||
const vhost = config.get('rabbitmq.virtual_host');
|
||||
const username = config.get('rabbitmq.username');
|
||||
const password = config.get('rabbitmq.password');
|
||||
const queueProperties = config.get('rabbitmq.queue-properties');
|
||||
const queueProperties = config.get('rabbitmq.queue_properties');
|
||||
const poolInterval = config.get('js.response_poll_interval');
|
||||
|
||||
const amqp = require('amqplib/callback_api');
|
||||
|
||||
@ -26,7 +26,7 @@ const requestTopic = config.get('request_topic');
|
||||
const namespaceName = config.get('service_bus.namespace_name');
|
||||
const sasKeyName = config.get('service_bus.sas_key_name');
|
||||
const sasKey = config.get('service_bus.sas_key');
|
||||
const queueProperties = config.get('service_bus.queue-properties');
|
||||
const queueProperties = config.get('service_bus.queue_properties');
|
||||
|
||||
let sbClient;
|
||||
let receiverClient;
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
const config = require('config'), logger = require('./config/logger')._logger('main');
|
||||
|
||||
const serviceType = config.get('service-type');
|
||||
const serviceType = config.get('queue_type');
|
||||
switch (serviceType) {
|
||||
case 'kafka':
|
||||
logger.info('Starting kafka template.');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user