/*******************************************************************************
 * Copyright (c) 2017 Arrow Electronics, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Apache License 2.0
 * which accompanies this distribution, and is available at
 * http://apache.org/licenses/LICENSE-2.0
 *
 * Contributors:
 *     Arrow Electronics, Inc.
 *******************************************************************************/
package com.arrow.acn;

public interface MqttConstants {
	// topic exchange
	final static String DEFAULT_RABBITMQ_EXCHANGE = "amq.topic";

	// durable incoming queue
	final static String DEFAULT_RABBITMQ_TELEMETRY_QUEUE = "kronos.telemetry";
	final static String DEFAULT_RABBITMQ_TELEMETRY_BATCH_QUEUE = "kronos.telemetry.batch";
	final static String DEFAULT_RABBITMQ_TELEMTRY_GZIP_BATCH_QUEUE = "kronos.telemetry.gzip.batch";
	final static String DEFAULT_RABBITMQ_COMMAND_QUEUE = "kronos.command";

	// application telemetry direct exchange
	final static String APPLICATION_TELEMETRY_EXCHANGE = "kronos.application.telemetry";

	static String applicationTelemetryRouting(String applicationHid) {
		return String.format("app.%s", applicationHid);
	}

	static String gatewayToServerTelemetryRouting(String gatewayHid) {
		return String.format("krs/tel/gts/%s", gatewayHid);
	}

	static boolean isGatewayToServerTelemetryRouting(String queueName) {
		return queueName.startsWith("krs/tel/gts/") || queueName.startsWith("krs.tel.gts.");
	}

	static String gatewayToServerTelemetryBatchRouting(String gatewayHid) {
		return String.format("krs/tel/bat/gts/%s", gatewayHid);
	}

	static boolean isGatewayToServerTelemetryBatchRouting(String queueName) {
		return queueName.startsWith("krs/tel/bat/gts/") || queueName.startsWith("krs.tel.bat.gts.");
	}

	static String gatewayToServerTelemetryGzipBatchRouting(String gatewayHid) {
		return String.format("krs/tel/gzb/gts/%s", gatewayHid);
	}

	static boolean isGatewayToServerTelemetryGzipBatchRouting(String queueName) {
		return queueName.startsWith("krs/tel/gzb/gts/") || queueName.startsWith("krs.tel.gzb.gts.");
	}

	static String gatewayToServerCommandRouting(String gatewayHid) {
		return String.format("krs/cmd/gts/%s", gatewayHid);
	}

	static String serverToGatewayTelemetryRouting(String gatewayHid) {
		return String.format("krs.tel.stg.%s", gatewayHid);
	}

	static String serverToGatewayCommandRouting(String gatewayHid) {
		return String.format("krs.cmd.stg.%s", gatewayHid);
	}
}
@@ -1333,25 +1333,25 @@
 mat(%22krs
-/tel/gts/
+.tel.gts.
 %25s%22, gat
@@ -1446,48 +1446,8 @@
 turn
- queueName.startsWith(%22krs/tel/gts/%22) %7C%7C
  que
@@ -1585,29 +1585,29 @@
 mat(%22krs
-/tel/bat/gts/
+.tel.bat.gts.
 %25s%22, gat
@@ -1707,52 +1707,8 @@
 turn
- queueName.startsWith(%22krs/tel/bat/gts/%22) %7C%7C
  que
@@ -1854,29 +1854,29 @@
 mat(%22krs
-/tel/gzb/gts/
+.tel.gzb.gts.
 %25s%22, gat
@@ -1980,52 +1980,8 @@
 turn
- queueName.startsWith(%22krs/tel/gzb/gts/%22) %7C%7C
  que
@@ -2120,17 +2120,17 @@
 %22krs
-/cmd/gts/
+.cmd.gts.
 %25s%22,

revert to previous version, last change caused a few issues