Update file to run config in application
This commit is contained in:
parent
a13f0afaa5
commit
20b387c5dd
|
@ -13,11 +13,17 @@ import org.springframework.context.annotation.Bean;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author YuCheng Hu
|
||||||
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class AMQPHelloWorldMessageApp {
|
public class AMQPHelloWorldMessageApp {
|
||||||
|
|
||||||
private static final boolean NON_DURABLE = true;
|
private static final boolean NON_DURABLE = true;
|
||||||
private static final String MY_QUEUE_NAME = "com.ossez.real.estate";
|
private static final String MY_QUEUE_NAME = "com.ossez.real.estate";
|
||||||
|
private static final String MY_QUEUE_HOSTMANME = "mq.ossez.com";
|
||||||
|
private static final String MY_QUEUE_USERNAME = "username";
|
||||||
|
private static final String MY_QUEUE_PASSWORD = "password";
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
@ -32,9 +38,9 @@ public class AMQPHelloWorldMessageApp {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ConnectionFactory connectionFactory() {
|
public ConnectionFactory connectionFactory() {
|
||||||
CachingConnectionFactory connectionFactory = new CachingConnectionFactory("158.69.60.50");
|
CachingConnectionFactory connectionFactory = new CachingConnectionFactory(MY_QUEUE_HOSTMANME);
|
||||||
connectionFactory.setUsername("admin");
|
connectionFactory.setUsername(MY_QUEUE_USERNAME);
|
||||||
connectionFactory.setPassword("Lucas#1120");
|
connectionFactory.setPassword(MY_QUEUE_PASSWORD);
|
||||||
|
|
||||||
return connectionFactory;
|
return connectionFactory;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +77,7 @@ public class AMQPHelloWorldMessageApp {
|
||||||
public ApplicationRunner runner(RabbitTemplate template) {
|
public ApplicationRunner runner(RabbitTemplate template) {
|
||||||
return args -> {
|
return args -> {
|
||||||
for (int i =0; i<1000; i++) {
|
for (int i =0; i<1000; i++) {
|
||||||
template.convertAndSend("Hello, world- YuCheng Hu!"+ i);
|
template.convertAndSend("Hello, world - OSSEZ.COM!"+ i);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue