Updated package prefix to use personal website
This commit is contained in:
@@ -21,9 +21,9 @@ dependencies {
|
||||
|
||||
tasks.getByName<BootJar>("bootJar") {
|
||||
enabled = true
|
||||
mainClass.set("com.poc.alerting.batch.BatchWorkerKt")
|
||||
mainClass.set("com.alexjclarke.alerting.batch.BatchWorkerKt")
|
||||
}
|
||||
|
||||
springBoot {
|
||||
mainClass.set("com.poc.alerting.batch.BatchWorkerKt")
|
||||
mainClass.set("com.alexjclarke.alerting.batch.BatchWorkerKt")
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.poc.alerting.batch;
|
||||
package com.alexjclarke.alerting.batch;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
+3
-4
@@ -1,4 +1,4 @@
|
||||
package com.poc.alerting.batch;
|
||||
package com.alexjclarke.alerting.batch;
|
||||
|
||||
import java.util.Base64;
|
||||
import java.util.stream.StreamSupport;
|
||||
@@ -10,7 +10,6 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||
import org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter;
|
||||
import org.springframework.amqp.support.converter.MessageConverter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
@@ -37,7 +36,7 @@ public class ApplicationStartup implements ApplicationListener<ApplicationReadyE
|
||||
LOG.info("Creating consumers for existing queues");
|
||||
try {
|
||||
|
||||
final String rabbitMqUrl = String.format("http://%s:15672/api/exchanges/poc/alerting/bindings/source", "localhost");
|
||||
final String rabbitMqUrl = String.format("http://%s:15672/api/exchanges/alexjclarke/alerting/bindings/source", "localhost");
|
||||
|
||||
//auth is kind of a kluge here. Apparently the HttpClient Fluent API doesn't support
|
||||
//it except by explicitly setting the auth header.
|
||||
@@ -59,7 +58,7 @@ public class ApplicationStartup implements ApplicationListener<ApplicationReadyE
|
||||
}
|
||||
|
||||
private String getAuthToken() {
|
||||
final String basicPlaintext = "poc" + ":" + "s!mpleP@ssw0rd";
|
||||
final String basicPlaintext = "api_user" + ":" + "s!mpleP@ssw0rd";
|
||||
|
||||
final Base64.Encoder encoder = Base64.getEncoder();
|
||||
return encoder.encodeToString(basicPlaintext.getBytes());
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.poc.alerting.batch;
|
||||
package com.alexjclarke.alerting.batch;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.springframework.amqp.support.ConditionalExceptionLogger;
|
||||
+6
-7
@@ -1,4 +1,4 @@
|
||||
package com.poc.alerting.batch;
|
||||
package com.alexjclarke.alerting.batch;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
@@ -13,15 +13,14 @@ import org.springframework.amqp.rabbit.core.RabbitAdmin;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.poc.alerting.amqp.AmqpMessage;
|
||||
import com.poc.alerting.amqp.AmqpResponse;
|
||||
import com.poc.alerting.amqp.ExceptionType;
|
||||
import com.alexjclarke.alerting.amqp.AmqpMessage;
|
||||
import com.alexjclarke.alerting.amqp.AmqpResponse;
|
||||
import com.alexjclarke.alerting.amqp.ExceptionType;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import static com.poc.alerting.amqp.AmqpConfiguration.AMQP_NAME;
|
||||
import static com.poc.alerting.batch.WorkerConfiguration.NEW_CONSUMER;
|
||||
import static com.alexjclarke.alerting.amqp.AmqpConfiguration.AMQP_NAME;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@@ -60,6 +59,6 @@ public class QueueCreator {
|
||||
}
|
||||
|
||||
private void sendCreateConsumerMessage(final String queueName) {
|
||||
rabbitTemplate.convertAndSend(NEW_CONSUMER, "", queueName);
|
||||
rabbitTemplate.convertAndSend(WorkerConfiguration.NEW_CONSUMER, "", queueName);
|
||||
}
|
||||
}
|
||||
+17
-17
@@ -1,17 +1,17 @@
|
||||
package com.poc.alerting.batch
|
||||
package com.alexjclarke.alerting.batch
|
||||
|
||||
import com.poc.alerting.amqp.AlertingAmqpMessage
|
||||
import com.poc.alerting.amqp.AlertingAmqpMessage.Add
|
||||
import com.poc.alerting.amqp.AlertingAmqpMessage.Delete
|
||||
import com.poc.alerting.amqp.AlertingAmqpMessage.Pause
|
||||
import com.poc.alerting.amqp.AlertingAmqpMessage.Resume
|
||||
import com.poc.alerting.amqp.AlertingAmqpMessage.Update
|
||||
import com.poc.alerting.batch.jobs.AlertQueryJob
|
||||
import com.poc.alerting.batch.jobs.AlertQueryJob.Companion.ACCOUNT_ID
|
||||
import com.poc.alerting.batch.jobs.AlertQueryJob.Companion.ALERT_ID
|
||||
import com.poc.alerting.batch.jobs.AlertQueryJob.Companion.CRON
|
||||
import com.poc.alerting.persistence.dto.Alert
|
||||
import com.poc.alerting.persistence.repositories.AlertRepository
|
||||
import com.alexjclarke.alerting.amqp.AlertingAmqpMessage
|
||||
import com.alexjclarke.alerting.amqp.AlertingAmqpMessage.Add
|
||||
import com.alexjclarke.alerting.amqp.AlertingAmqpMessage.Delete
|
||||
import com.alexjclarke.alerting.amqp.AlertingAmqpMessage.Pause
|
||||
import com.alexjclarke.alerting.amqp.AlertingAmqpMessage.Resume
|
||||
import com.alexjclarke.alerting.amqp.AlertingAmqpMessage.Update
|
||||
import com.alexjclarke.alerting.batch.jobs.AlertQueryJob
|
||||
import com.alexjclarke.alerting.batch.jobs.AlertQueryJob.Companion.ACCOUNT_ID
|
||||
import com.alexjclarke.alerting.batch.jobs.AlertQueryJob.Companion.ALERT_ID
|
||||
import com.alexjclarke.alerting.batch.jobs.AlertQueryJob.Companion.CRON
|
||||
import com.alexjclarke.alerting.persistence.dto.Alert
|
||||
import com.alexjclarke.alerting.persistence.repositories.AlertRepository
|
||||
import org.quartz.CronScheduleBuilder
|
||||
import org.quartz.JobBuilder
|
||||
import org.quartz.JobDataMap
|
||||
@@ -49,7 +49,7 @@ open class AccountWorker @Autowired constructor(
|
||||
start()
|
||||
}
|
||||
|
||||
return alertRepository.findByExtIdAndAccount_Id(alertId, accountId)
|
||||
return alertRepository.findByExtIdAndAccount_ExtId(alertId, accountId)
|
||||
}
|
||||
|
||||
private fun updateJob(alertId: String, accountId: String, cron: String): Alert {
|
||||
@@ -58,7 +58,7 @@ open class AccountWorker @Autowired constructor(
|
||||
}
|
||||
|
||||
private fun deleteJob(alertId: String, accountId: String): Alert {
|
||||
val alert = alertRepository.findByExtIdAndAccount_Id(alertId, accountId)
|
||||
val alert = alertRepository.findByExtIdAndAccount_ExtId(alertId, accountId)
|
||||
scheduler.deleteJob(JobKey.jobKey(alertId, accountId))
|
||||
alertRepository.delete(alert)
|
||||
return alert
|
||||
@@ -66,12 +66,12 @@ open class AccountWorker @Autowired constructor(
|
||||
|
||||
private fun pauseJob(alertId: String, accountId: String): Alert {
|
||||
scheduler.pauseJob(JobKey.jobKey(alertId, accountId))
|
||||
return alertRepository.findByExtIdAndAccount_Id(alertId, accountId)
|
||||
return alertRepository.findByExtIdAndAccount_ExtId(alertId, accountId)
|
||||
}
|
||||
|
||||
private fun resumeJob(alertId: String, accountId: String): Alert {
|
||||
scheduler.resumeJob(JobKey.jobKey(alertId, accountId))
|
||||
return alertRepository.findByExtIdAndAccount_Id(alertId, accountId)
|
||||
return alertRepository.findByExtIdAndAccount_ExtId(alertId, accountId)
|
||||
}
|
||||
|
||||
private fun buildJob(alertId: String, accountId: String, cron: String): JobDetail {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.poc.alerting.batch
|
||||
package com.alexjclarke.alerting.batch
|
||||
|
||||
import org.quartz.Job
|
||||
import org.quartz.SchedulerContext
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
package com.poc.alerting.batch
|
||||
package com.alexjclarke.alerting.batch
|
||||
|
||||
import org.springframework.boot.Banner
|
||||
import org.springframework.boot.WebApplicationType
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder
|
||||
|
||||
@SpringBootApplication(scanBasePackages = ["com.poc.alerting"])
|
||||
@SpringBootApplication(scanBasePackages = ["com.alexjclarke.alerting"])
|
||||
open class BatchWorker
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.poc.alerting.batch
|
||||
package com.alexjclarke.alerting.batch
|
||||
|
||||
import org.apache.commons.lang3.time.DateUtils
|
||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.poc.alerting.batch
|
||||
package com.alexjclarke.alerting.batch
|
||||
|
||||
import com.poc.alerting.amqp.AmqpConfiguration.Companion.NEW_ACCOUNT
|
||||
import com.poc.alerting.amqp.GsonMessageConverter
|
||||
import com.alexjclarke.alerting.amqp.AmqpConfiguration.Companion.NEW_ACCOUNT
|
||||
import com.alexjclarke.alerting.amqp.GsonMessageConverter
|
||||
import org.springframework.amqp.core.Binding
|
||||
import org.springframework.amqp.core.BindingBuilder
|
||||
import org.springframework.amqp.core.FanoutExchange
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
package com.poc.alerting.batch.jobs
|
||||
package com.alexjclarke.alerting.batch.jobs
|
||||
|
||||
import com.poc.alerting.persistence.repositories.AlertRepository
|
||||
import com.alexjclarke.alerting.persistence.repositories.AlertRepository
|
||||
import org.quartz.Job
|
||||
import org.quartz.JobExecutionContext
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
@@ -24,7 +24,7 @@ open class AlertQueryJob @Autowired constructor(
|
||||
val cron = data.getString(CRON)
|
||||
val accountId = data.getString(ACCOUNT_ID)
|
||||
|
||||
val alert = alertRepository.findByExtIdAndAccount_Id(alertId, accountId)
|
||||
val alert = alertRepository.findByExtIdAndAccount_ExtId(alertId, accountId)
|
||||
|
||||
with(alert) {
|
||||
val queryResult = type.query()
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.poc.alerting.batch.jobs
|
||||
package com.alexjclarke.alerting.batch.jobs
|
||||
|
||||
import com.poc.alerting.batch.AutowiringSpringBeanJobFactory
|
||||
import com.alexjclarke.alerting.batch.AutowiringSpringBeanJobFactory
|
||||
import org.quartz.spi.JobFactory
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
|
||||
import org.springframework.context.ApplicationContext
|
||||
Reference in New Issue
Block a user