Skip to content

Commit

Permalink
Refactored creation of RabbitManager
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioKusek committed Mar 30, 2018
1 parent 4d831a5 commit 6cf3b4a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ buildscript {
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath group: 'com.cinnober.gradle', name: 'semver-git', version: '2.3.1'
}
}

Expand All @@ -27,14 +28,14 @@ plugins {
id "maven-publish"
}

apply plugin: 'com.cinnober.gradle.semver-git'

group = 'eu.h2020.symbiote'
version = '0.3.1'

// this is needed for starter to not create fat jar
bootRepackage.enabled = false

jar {
baseName = 'rap-plugin'
version = project.version
}

Expand Down Expand Up @@ -100,14 +101,13 @@ dependencies {

dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Dalston.SR2"
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Dalston.SR5"
}
}

// creating source jar
task sourceJar(type: Jar) {
from sourceSets.main.allJava
baseName = 'rap-plugin'
version = project.version
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
import eu.h2020.symbiote.rapplugin.TestingRabbitConfig;

@RunWith(SpringRunner.class)
@Import({RabbitManager.class,
TestingRabbitConfig.class,
@Import({TestingRabbitConfig.class,
RapPluginProperties.class})
@EnableConfigurationProperties({RabbitConnectionProperties.class, RapProperties.class})
@DirtiesContext
Expand All @@ -59,6 +58,11 @@ public static class TestConfiguration {
public RapPlugin rapPlugin(RabbitManager manager) {
return new RapPlugin(manager, "platId", false, true);
}

@Bean
public RabbitManager rapRabbitManager(RabbitTemplate template) {
return new RabbitManager(template);
}
}

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import eu.h2020.symbiote.rapplugin.messaging.RabbitManager;
import eu.h2020.symbiote.rapplugin.properties.RabbitConnectionProperties;
import eu.h2020.symbiote.rapplugin.properties.RapProperties;

Expand All @@ -28,6 +31,11 @@
public class RapPluginConfiguration implements ApplicationContextAware {
private static final Logger LOG = LoggerFactory.getLogger(RapPluginConfiguration.class);

@Bean
public RabbitManager rapRabbitManager(RabbitTemplate template) {
return new RabbitManager(template);
}

@Autowired
private SimpleRabbitListenerContainerFactory simpleRabbitListenerContainerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*
* @author mateuszl, Petar Krivic, Mario Kusek
*/
@Component
public class RabbitManager {
private static final Logger LOG = LoggerFactory.getLogger(RabbitManager.class);
private static final int REPLY_TIMEOUT = 20_000;
Expand Down

0 comments on commit 6cf3b4a

Please sign in to comment.