Qpid is now included with as an api depenency
Addingtests Adding javadocs Adding test Bugs: Bug 2047143 Bug 2047131 Bug 2047058 Correcting an invalid look variable which was not thread safe. Fixing handling of lists in constructors Change-Id: Ie3ee97a70edbda291757c6f14676f1c653ca71b1
This commit is contained in:
parent
1c908a05ce
commit
cf403ba303
@ -15,9 +15,7 @@ dependencies {
|
|||||||
// Use the latest Groovy version for building this library
|
// Use the latest Groovy version for building this library
|
||||||
implementation 'org.codehaus.groovy:groovy-all:3.0.10'
|
implementation 'org.codehaus.groovy:groovy-all:3.0.10'
|
||||||
|
|
||||||
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
|
api group: 'org.apache.qpid', name: 'protonj2-client', version: '1.0.0-M16'
|
||||||
implementation 'com.google.guava:guava:31.0.1-jre'
|
|
||||||
implementation group: 'org.apache.qpid', name: 'protonj2-client', version: '1.0.0-M16'
|
|
||||||
implementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.12'
|
implementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.12'
|
||||||
implementation group: 'org.aeonbits.owner', name: 'owner', version: '1.0.12'
|
implementation group: 'org.aeonbits.owner', name: 'owner', version: '1.0.12'
|
||||||
|
|
||||||
|
@ -39,9 +39,9 @@ class MyPublisherTestConnectorHandler extends ConnectorHandler {
|
|||||||
developer, a check never did any harm.
|
developer, a check never did any harm.
|
||||||
|
|
||||||
The state publisher is a core publisher with the required
|
The state publisher is a core publisher with the required
|
||||||
methods to pubilsh component state.
|
methods to publish component state.
|
||||||
|
|
||||||
Calling these methods and bootstraing them into the application
|
Calling these methods and bootstrapping them into the application
|
||||||
logic falls on the developer.
|
logic falls on the developer.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@ -70,7 +70,7 @@ class MyPublisherTestConnectorHandler extends ConnectorHandler {
|
|||||||
"one"
|
"one"
|
||||||
);
|
);
|
||||||
(context.getPublisher("config")).send(
|
(context.getPublisher("config")).send(
|
||||||
Map.of("hello","world"),
|
Map.of("good","bye"),
|
||||||
"two"
|
"two"
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -105,7 +105,8 @@ class TestPublisher{
|
|||||||
"localhost",
|
"localhost",
|
||||||
5672,
|
5672,
|
||||||
"admin",
|
"admin",
|
||||||
"admin"
|
"admin",
|
||||||
|
5
|
||||||
)
|
)
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -81,7 +81,6 @@ class TestReceiver{
|
|||||||
new Consumer("config_two","config", new Handler(){
|
new Consumer("config_two","config", new Handler(){
|
||||||
@Override
|
@Override
|
||||||
public void onMessage(String key, String address, Map body, Message rawMessage, Context context) {
|
public void onMessage(String key, String address, Map body, Message rawMessage, Context context) {
|
||||||
|
|
||||||
System.out.println("These are my TWO config => "+ String.valueOf(body));
|
System.out.println("These are my TWO config => "+ String.valueOf(body));
|
||||||
}
|
}
|
||||||
},"two", true)
|
},"two", true)
|
||||||
|
@ -69,7 +69,6 @@ public class Connector {
|
|||||||
}
|
}
|
||||||
this.config = configuration
|
this.config = configuration
|
||||||
this.context = new Context(
|
this.context = new Context(
|
||||||
"${configuration.url()}:${configuration.port()}",
|
|
||||||
"${configuration.baseName()}.${this.component}",
|
"${configuration.baseName()}.${this.component}",
|
||||||
handler
|
handler
|
||||||
)
|
)
|
||||||
|
@ -24,7 +24,6 @@ class Context {
|
|||||||
|
|
||||||
Logger logger = LoggerFactory.getLogger(Context.class)
|
Logger logger = LoggerFactory.getLogger(Context.class)
|
||||||
|
|
||||||
private final String uri
|
|
||||||
private final String base
|
private final String base
|
||||||
private final Map<String,Publisher> publishers = [:]
|
private final Map<String,Publisher> publishers = [:]
|
||||||
private final Map<String,Consumer> consumers = [:]
|
private final Map<String,Consumer> consumers = [:]
|
||||||
@ -32,8 +31,7 @@ class Context {
|
|||||||
|
|
||||||
private Manager manager
|
private Manager manager
|
||||||
|
|
||||||
public Context(String uri, String base, ConnectorHandler handler){
|
public Context(String base, ConnectorHandler handler){
|
||||||
this.uri = uri
|
|
||||||
this.base = base
|
this.base = base
|
||||||
this.handler = handler
|
this.handler = handler
|
||||||
}
|
}
|
||||||
@ -98,6 +96,11 @@ class Context {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void registerPublisher(Publisher publisher) {
|
void registerPublisher(Publisher publisher) {
|
||||||
|
if(publishers.containsKey(publisher.key)){
|
||||||
|
logger.warn("Trying to register a publisher that is already registered {}=>{} ",publisher.key(), publisher.address())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
publishers[publisher.key()] = publisher
|
publishers[publisher.key()] = publisher
|
||||||
if(this.manager !=null && this.manager.getRunning()){
|
if(this.manager !=null && this.manager.getRunning()){
|
||||||
final Publisher p =publisher
|
final Publisher p =publisher
|
||||||
@ -106,6 +109,10 @@ class Context {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void registerConsumer(Consumer consumer) {
|
void registerConsumer(Consumer consumer) {
|
||||||
|
if(consumers.containsKey(consumer.key)){
|
||||||
|
logger.warn("Trying to register a consumer that is already registered {}=>{} ",consumer.key(),consumer.address())
|
||||||
|
return
|
||||||
|
}
|
||||||
logger.debug("Registering consumer {}=>{}",consumer.key(),consumer.address())
|
logger.debug("Registering consumer {}=>{}",consumer.key(),consumer.address())
|
||||||
consumers[consumer.key()] = consumer
|
consumers[consumer.key()] = consumer
|
||||||
if(this.manager !=null && this.manager.getRunning()){
|
if(this.manager !=null && this.manager.getRunning()){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user