Commit 9ef3445b7723a48ad2b96d6cf3d1b3830e946635

Authored by YevhenBondarenko
1 parent b8a305ec

refactored

... ... @@ -14,7 +14,7 @@
14 14 # limitations under the License.
15 15 #
16 16
17   -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)
  17 +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)
18 18 request_topic: "REMOTE_JS_EVAL_REQUEST_TOPIC"
19 19
20 20 js:
... ... @@ -25,18 +25,18 @@ kafka:
25 25 # Kafka Bootstrap Servers
26 26 servers: "TB_KAFKA_SERVERS"
27 27 replication_factor: "TB_QUEUE_KAFKA_REPLICATION_FACTOR"
28   - topic-properties: "TB_QUEUE_KAFKA_JE_TOPIC_PROPERTIES"
  28 + topic_properties: "TB_QUEUE_KAFKA_JE_TOPIC_PROPERTIES"
29 29
30 30 pubsub:
31 31 project_id: "TB_QUEUE_PUBSUB_PROJECT_ID"
32 32 service_account: "TB_QUEUE_PUBSUB_SERVICE_ACCOUNT"
33   - queue-properties: "TB_QUEUE_PUBSUB_JE_QUEUE_PROPERTIES"
  33 + queue_properties: "TB_QUEUE_PUBSUB_JE_QUEUE_PROPERTIES"
34 34
35 35 aws_sqs:
36 36 access_key_id: "TB_QUEUE_AWS_SQS_ACCESS_KEY_ID"
37 37 secret_access_key: "TB_QUEUE_AWS_SQS_SECRET_ACCESS_KEY"
38 38 region: "TB_QUEUE_AWS_SQS_REGION"
39   - queue-properties: "TB_QUEUE_AWS_SQS_JE_QUEUE_PROPERTIES"
  39 + queue_properties: "TB_QUEUE_AWS_SQS_JE_QUEUE_PROPERTIES"
40 40
41 41 rabbitmq:
42 42 host: "TB_QUEUE_RABBIT_MQ_HOST"
... ... @@ -44,14 +44,14 @@ rabbitmq:
44 44 virtual_host: "TB_QUEUE_RABBIT_MQ_VIRTUAL_HOST"
45 45 username: "TB_QUEUE_RABBIT_MQ_USERNAME"
46 46 password: "TB_QUEUE_RABBIT_MQ_PASSWORD"
47   - queue-properties: "TB_QUEUE_RABBIT_MQ_JE_QUEUE_PROPERTIES"
  47 + queue_properties: "TB_QUEUE_RABBIT_MQ_JE_QUEUE_PROPERTIES"
48 48
49 49 service_bus:
50 50 namespace_name: "TB_QUEUE_SERVICE_BUS_NAMESPACE_NAME"
51 51 sas_key_name: "TB_QUEUE_SERVICE_BUS_SAS_KEY_NAME"
52 52 sas_key: "TB_QUEUE_SERVICE_BUS_SAS_KEY"
53 53 max_messages: "TB_QUEUE_SERVICE_BUS_MAX_MESSAGES"
54   - queue-properties: "TB_QUEUE_SERVICE_BUS_JE_QUEUE_PROPERTIES"
  54 + queue_properties: "TB_QUEUE_SERVICE_BUS_JE_QUEUE_PROPERTIES"
55 55
56 56 logger:
57 57 level: "LOGGER_LEVEL"
... ...
... ... @@ -14,7 +14,7 @@
14 14 # limitations under the License.
15 15 #
16 16
17   -service-type: "kafka"
  17 +queue_type: "kafka"
18 18 request_topic: "js_eval.requests"
19 19
20 20 js:
... ... @@ -25,13 +25,13 @@ kafka:
25 25 # Kafka Bootstrap Servers
26 26 servers: "localhost:9092"
27 27 replication_factor: "1"
28   - topic-properties: "retention.ms:604800000;segment.bytes:26214400;retention.bytes:104857600"
  28 + topic_properties: "retention.ms:604800000;segment.bytes:26214400;retention.bytes:104857600"
29 29
30 30 pubsub:
31   - queue-properties: "ackDeadlineInSec:30;messageRetentionInSec:604800"
  31 + queue_properties: "ackDeadlineInSec:30;messageRetentionInSec:604800"
32 32
33 33 aws_sqs:
34   - queue-properties: "VisibilityTimeout:30;MaximumMessageSize:262144;MessageRetentionPeriod:604800"
  34 + queue_properties: "VisibilityTimeout:30;MaximumMessageSize:262144;MessageRetentionPeriod:604800"
35 35
36 36 rabbitmq:
37 37 host: "localhost"
... ... @@ -39,10 +39,10 @@ rabbitmq:
39 39 virtual_host: "/"
40 40 username: "admin"
41 41 password: "password"
42   - queue-properties: "x-max-length-bytes:1048576000;x-message-ttl:604800000"
  42 + queue_properties: "x-max-length-bytes:1048576000;x-message-ttl:604800000"
43 43
44 44 service_bus:
45   - queue-properties: "lockDurationInSec:30;maxSizeInMb:1024;messageTimeToLiveInSec:604800"
  45 + queue_properties: "lockDurationInSec:30;maxSizeInMb:1024;messageTimeToLiveInSec:604800"
46 46
47 47 logger:
48 48 level: "info"
... ...
... ... @@ -26,7 +26,7 @@ const accessKeyId = config.get('aws_sqs.access_key_id');
26 26 const secretAccessKey = config.get('aws_sqs.secret_access_key');
27 27 const region = config.get('aws_sqs.region');
28 28 const AWS = require('aws-sdk');
29   -const queueProperties = config.get('aws_sqs.queue-properties');
  29 +const queueProperties = config.get('aws_sqs.queue_properties');
30 30 const poolInterval = config.get('js.response_poll_interval');
31 31
32 32 let queueAttributes = {FifoQueue: 'true', ContentBasedDeduplication: 'true'};
... ...
... ... @@ -20,7 +20,7 @@ const config = require('config'),
20 20 logger = require('../config/logger')._logger('kafkaTemplate'),
21 21 KafkaJsWinstonLogCreator = require('../config/logger').KafkaJsWinstonLogCreator;
22 22 const replicationFactor = config.get('kafka.replication_factor');
23   -const topicProperties = config.get('kafka.topic-properties');
  23 +const topicProperties = config.get('kafka.topic_properties');
24 24
25 25 let kafkaClient;
26 26 let kafkaAdmin;
... ...
... ... @@ -24,7 +24,7 @@ const {PubSub} = require('@google-cloud/pubsub');
24 24 const projectId = config.get('pubsub.project_id');
25 25 const credentials = JSON.parse(config.get('pubsub.service_account'));
26 26 const requestTopic = config.get('request_topic');
27   -const queueProperties = config.get('pubsub.queue-properties');
  27 +const queueProperties = config.get('pubsub.queue_properties');
28 28
29 29 let pubSubClient;
30 30
... ...
... ... @@ -26,7 +26,7 @@ const port = config.get('rabbitmq.port');
26 26 const vhost = config.get('rabbitmq.virtual_host');
27 27 const username = config.get('rabbitmq.username');
28 28 const password = config.get('rabbitmq.password');
29   -const queueProperties = config.get('rabbitmq.queue-properties');
  29 +const queueProperties = config.get('rabbitmq.queue_properties');
30 30 const poolInterval = config.get('js.response_poll_interval');
31 31
32 32 const amqp = require('amqplib/callback_api');
... ...
... ... @@ -26,7 +26,7 @@ const requestTopic = config.get('request_topic');
26 26 const namespaceName = config.get('service_bus.namespace_name');
27 27 const sasKeyName = config.get('service_bus.sas_key_name');
28 28 const sasKey = config.get('service_bus.sas_key');
29   -const queueProperties = config.get('service_bus.queue-properties');
  29 +const queueProperties = config.get('service_bus.queue_properties');
30 30
31 31 let sbClient;
32 32 let receiverClient;
... ...
... ... @@ -16,7 +16,7 @@
16 16
17 17 const config = require('config'), logger = require('./config/logger')._logger('main');
18 18
19   -const serviceType = config.get('service-type');
  19 +const serviceType = config.get('queue_type');
20 20 switch (serviceType) {
21 21 case 'kafka':
22 22 logger.info('Starting kafka template.');
... ...