EzyActiveMQ Configuration
Updated at 16856876850001. Configuration List
EzyActiveMQ provides a list of configurations in bellow table:| Property | Default Value | Description | |
| 1 | activemq.uri | failover://tcp://localhost:61616 | ActiveMQ uri |
| 2 | activemq.username | null | ActiveMQ username |
| 3 | activemq.password | null | ActiveMQ password |
| 4 | activemq.max_thread_pool_size | 1000 | Max thread pool size |
| 6 | activemq.producers | null | List of ActiveMQ producers |
| 5 | activemq.consumers | null | List of ActiveMQ consumers |
| 7 | activemq.topics | null | List of ActiveMQ topics |
For every producer, EzyActiveMQ provides bellow properties:
| Property | Default Value | Description | |
| 1 | request_queue_name | [producer name]-request | Name of the request queue |
| 2 | reply_queue_name | [producer name]-reply | Name of the reply queue |
| 3 | thread_pool_size | 1 | Thread pool size for reply message consumer |
| 4 | capacity | 10000 | Capacity of the producer |
| 5 | default_timeout | no timeout | Default timeout of a rpc request in millisecond |
For every consumer, EzyActiveMQ provides bellow properties:
| Property | Default Value | Description | |
| 1 | request_queue_name | [consumer name]-request | Name of the request queue |
| 2 | reply_queue_name | [consumer name]-reply | Name of the consumer's request queue of the producer |
| 3 | thread_pool_size | 1 | Thread pool size for rquest message consumer |
For every topic, EzyActiveMQ provides bellow properties:
| Property | Default Value | Description | |
| 1 | producer | null | Producer for the topic settings |
| 2 | producer.enable | true if producer is not null | Enable producer or not |
| 3 | consumer | null | Consumer for the topic settings |
| 4 | consumer.enable | true if consumer is not null | Enable consumer or not |
2. An Example
Let's we neen create a producer and a consumer named test and a topic named hello, you can put bellow configuration to your application.yaml file:
# for application.yaml
activemq:
producers:
test: default
consumers:
test: default
topics:
hello:
producer: default
consumer: default
Or for application.properties file:
# for application.properties activemq.producers.test=default activemq.consumers.test=default activemq.topics.hello.producer=default activemq.topics.hello.consumer=default
3. Configure for producer
You can configure for producer like this:
EzyActiveMQProxy proxy = EzyActiveMQProxy.builder()
.scan("com.tvd12.ezymq.activemq.test")
.mapTopicMessageType("hello", "hello", SumRequest.class)
.build();
EzyActiveRpcProducer producer = proxy.getRpcProducer("test");
4. Configure for consumer
You can configure for consumer like this:
EzyActiveMQProxy.builder()
.addSingleton(someSingleton)
.scan("com.tvd12.ezymq.activemq.test")
.build();
5. Topic usage
You can get the topic like this:
EzyActiveTopic<SumRequest> sumTopic = proxy.getTopic("hello");
And use the topic to publish a message like this:
sumTopic.publish("hello", new SumRequest(a, b));
You also can add message consumer for the topic like this:
sumTopic.addConsumer("hello", message -> System.out.println("sum request: " + message) );