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:
Fotis Paraskevopoulos 2023-11-29 12:10:18 +01:00
parent 1c908a05ce
commit cf403ba303
5 changed files with 16 additions and 12 deletions

View File

@ -15,9 +15,7 @@ dependencies {
// Use the latest Groovy version for building this library
implementation 'org.codehaus.groovy:groovy-all:3.0.10'
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:31.0.1-jre'
implementation group: 'org.apache.qpid', name: 'protonj2-client', version: '1.0.0-M16'
api 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.aeonbits.owner', name: 'owner', version: '1.0.12'

View File

@ -39,9 +39,9 @@ class MyPublisherTestConnectorHandler extends ConnectorHandler {
developer, a check never did any harm.
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.
*/
@ -70,7 +70,7 @@ class MyPublisherTestConnectorHandler extends ConnectorHandler {
"one"
);
(context.getPublisher("config")).send(
Map.of("hello","world"),
Map.of("good","bye"),
"two"
);
@ -105,7 +105,8 @@ class TestPublisher{
"localhost",
5672,
"admin",
"admin"
"admin",
5
)
);

View File

@ -81,7 +81,6 @@ class TestReceiver{
new Consumer("config_two","config", new Handler(){
@Override
public void onMessage(String key, String address, Map body, Message rawMessage, Context context) {
System.out.println("These are my TWO config => "+ String.valueOf(body));
}
},"two", true)

View File

@ -69,7 +69,6 @@ public class Connector {
}
this.config = configuration
this.context = new Context(
"${configuration.url()}:${configuration.port()}",
"${configuration.baseName()}.${this.component}",
handler
)

View File

@ -24,7 +24,6 @@ class Context {
Logger logger = LoggerFactory.getLogger(Context.class)
private final String uri
private final String base
private final Map<String,Publisher> publishers = [:]
private final Map<String,Consumer> consumers = [:]
@ -32,8 +31,7 @@ class Context {
private Manager manager
public Context(String uri, String base, ConnectorHandler handler){
this.uri = uri
public Context(String base, ConnectorHandler handler){
this.base = base
this.handler = handler
}
@ -98,6 +96,11 @@ class Context {
}
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
if(this.manager !=null && this.manager.getRunning()){
final Publisher p =publisher
@ -106,6 +109,10 @@ class Context {
}
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())
consumers[consumer.key()] = consumer
if(this.manager !=null && this.manager.getRunning()){