Coder Social home page Coder Social logo

spring-cloud / spring-cloud-bus Goto Github PK

View Code? Open in Web Editor NEW
402.0 57.0 241.0 3 MB

Spring Cloud event bus

Home Page: http://cloud.spring.io/spring-cloud-bus/

License: Apache License 2.0

Ruby 0.27% Java 99.73%
java spring spring-boot spring-cloud microservices messaging cloud-native spring-cloud-core

spring-cloud-bus's Introduction

Spring Cloud Bus

Quick Start

Building

Spring Cloud is released under the non-restrictive Apache 2.0 license, and follows a very standard Github development process, using Github tracker for issues and merging pull requests into main. If you want to contribute even something trivial please do not hesitate, but follow the guidelines below.

Sign the Contributor License Agreement

Before we accept a non-trivial patch or pull request we will need you to sign the Contributor License Agreement. Signing the contributor’s agreement does not grant anyone commit rights to the main repository, but it does mean that we can accept your contributions, and you will get an author credit if we do. Active contributors might be asked to join the core team, and given the ability to merge pull requests.

Code of Conduct

This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [email protected].

Code Conventions and Housekeeping

None of these is essential for a pull request, but they will all help. They can also be added after the original pull request but before a merge.

  • Use the Spring Framework code format conventions. If you use Eclipse you can import formatter settings using the eclipse-code-formatter.xml file from the Spring Cloud Build project. If using IntelliJ, you can use the Eclipse Code Formatter Plugin to import the same file.

  • Make sure all new .java files to have a simple Javadoc class comment with at least an @author tag identifying you, and preferably at least a paragraph on what the class is for.

  • Add the ASF license header comment to all new .java files (copy from existing files in the project)

  • Add yourself as an @author to the .java files that you modify substantially (more than cosmetic changes).

  • Add some Javadocs and, if you change the namespace, some XSD doc elements.

  • A few unit tests would help a lot as well — someone has to do it.

  • If no-one else is using your branch, please rebase it against the current main (or other target branch in the main project).

  • When writing a commit message please follow these conventions, if you are fixing an existing issue please add Fixes gh-XXXX at the end of the commit message (where XXXX is the issue number).

Checkstyle

Spring Cloud Build comes with a set of checkstyle rules. You can find them in the spring-cloud-build-tools module. The most notable files under the module are:

spring-cloud-build-tools/
└── src
    ├── checkstyle
    │   └── checkstyle-suppressions.xml (3)
    └── main
        └── resources
            ├── checkstyle-header.txt (2)
            └── checkstyle.xml (1)
  1. Default Checkstyle rules

  2. File header setup

  3. Default suppression rules

Checkstyle configuration

Checkstyle rules are disabled by default. To add checkstyle to your project just define the following properties and plugins.

pom.xml
<properties>
<maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError> (1)
        <maven-checkstyle-plugin.failsOnViolation>true
        </maven-checkstyle-plugin.failsOnViolation> (2)
        <maven-checkstyle-plugin.includeTestSourceDirectory>true
        </maven-checkstyle-plugin.includeTestSourceDirectory> (3)
</properties>

<build>
        <plugins>
            <plugin> (4)
                <groupId>io.spring.javaformat</groupId>
                <artifactId>spring-javaformat-maven-plugin</artifactId>
            </plugin>
            <plugin> (5)
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>
        </plugins>

    <reporting>
        <plugins>
            <plugin> (5)
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>
        </plugins>
    </reporting>
</build>
  1. Fails the build upon Checkstyle errors

  2. Fails the build upon Checkstyle violations

  3. Checkstyle analyzes also the test sources

  4. Add the Spring Java Format plugin that will reformat your code to pass most of the Checkstyle formatting rules

  5. Add checkstyle plugin to your build and reporting phases

If you need to suppress some rules (e.g. line length needs to be longer), then it’s enough for you to define a file under ${project.root}/src/checkstyle/checkstyle-suppressions.xml with your suppressions. Example:

projectRoot/src/checkstyle/checkstyle-suppresions.xml
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
		"-//Puppy Crawl//DTD Suppressions 1.1//EN"
		"https://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
	<suppress files=".*ConfigServerApplication\.java" checks="HideUtilityClassConstructor"/>
	<suppress files=".*ConfigClientWatch\.java" checks="LineLengthCheck"/>
</suppressions>

It’s advisable to copy the ${spring-cloud-build.rootFolder}/.editorconfig and ${spring-cloud-build.rootFolder}/.springformat to your project. That way, some default formatting rules will be applied. You can do so by running this script:

$ curl https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/.editorconfig -o .editorconfig
$ touch .springformat

IDE setup

Intellij IDEA

In order to setup Intellij you should import our coding conventions, inspection profiles and set up the checkstyle plugin. The following files can be found in the Spring Cloud Build project.

spring-cloud-build-tools/
└── src
    ├── checkstyle
    │   └── checkstyle-suppressions.xml (3)
    └── main
        └── resources
            ├── checkstyle-header.txt (2)
            ├── checkstyle.xml (1)
            └── intellij
                ├── Intellij_Project_Defaults.xml (4)
                └── Intellij_Spring_Boot_Java_Conventions.xml (5)
  1. Default Checkstyle rules

  2. File header setup

  3. Default suppression rules

  4. Project defaults for Intellij that apply most of Checkstyle rules

  5. Project style conventions for Intellij that apply most of Checkstyle rules

Code style
Figure 1. Code style

Go to FileSettingsEditorCode style. There click on the icon next to the Scheme section. There, click on the Import Scheme value and pick the Intellij IDEA code style XML option. Import the spring-cloud-build-tools/src/main/resources/intellij/Intellij_Spring_Boot_Java_Conventions.xml file.

Code style
Figure 2. Inspection profiles

Go to FileSettingsEditorInspections. There click on the icon next to the Profile section. There, click on the Import Profile and import the spring-cloud-build-tools/src/main/resources/intellij/Intellij_Project_Defaults.xml file.

Checkstyle

To have Intellij work with Checkstyle, you have to install the Checkstyle plugin. It’s advisable to also install the Assertions2Assertj to automatically convert the JUnit assertions

Checkstyle

Go to FileSettingsOther settingsCheckstyle. There click on the + icon in the Configuration file section. There, you’ll have to define where the checkstyle rules should be picked from. In the image above, we’ve picked the rules from the cloned Spring Cloud Build repository. However, you can point to the Spring Cloud Build’s GitHub repository (e.g. for the checkstyle.xml : https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/spring-cloud-build-tools/src/main/resources/checkstyle.xml). We need to provide the following variables:

Important
Remember to set the Scan Scope to All sources since we apply checkstyle rules for production and test sources.

Duplicate Finder

Spring Cloud Build brings along the basepom:duplicate-finder-maven-plugin, that enables flagging duplicate and conflicting classes and resources on the java classpath.

Duplicate Finder configuration

Duplicate finder is enabled by default and will run in the verify phase of your Maven build, but it will only take effect in your project if you add the duplicate-finder-maven-plugin to the build section of the projecst’s pom.xml.

pom.xml
<build>
    <plugins>
        <plugin>
            <groupId>org.basepom.maven</groupId>
            <artifactId>duplicate-finder-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

For other properties, we have set defaults as listed in the plugin documentation.

You can easily override them but setting the value of the selected property prefixed with duplicate-finder-maven-plugin. For example, set duplicate-finder-maven-plugin.skip to true in order to skip duplicates check in your build.

If you need to add ignoredClassPatterns or ignoredResourcePatterns to your setup, make sure to add them in the plugin configuration section of your project:

<build>
    <plugins>
        <plugin>
            <groupId>org.basepom.maven</groupId>
            <artifactId>duplicate-finder-maven-plugin</artifactId>
            <configuration>
                <ignoredClassPatterns>
                    <ignoredClassPattern>org.joda.time.base.BaseDateTime</ignoredClassPattern>
                    <ignoredClassPattern>.*module-info</ignoredClassPattern>
                </ignoredClassPatterns>
                <ignoredResourcePatterns>
                    <ignoredResourcePattern>changelog.txt</ignoredResourcePattern>
                </ignoredResourcePatterns>
            </configuration>
        </plugin>
    </plugins>
</build>

spring-cloud-bus's People

Contributors

behrangsa avatar bijukunjummen avatar brojowski avatar buzzardo avatar dependabot-preview[bot] avatar dl1ely avatar donovanmuller avatar elefeint avatar haybu avatar marcingrzejszczak avatar maxromanovsky avatar mbogoevici avatar melled avatar nurk avatar olgamaciaszek avatar ryanjbaxter avatar spencergibb avatar spring-builds avatar spring-operator avatar steve-oakey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spring-cloud-bus's Issues

Expose BusMvcEndpoint Operations via JMX

It would be beneficial to have the BusMvcEndpoint operations exposed to JMX. We use the Spring Boot Admin dashboard which gives very easy access to JMX operations via Jolokia. In this case it is much easier for administrators to access these operations rather than POST'ing to the specific endpoints.

Willing to contribute if this is a welcome contribution. I have already done this for some custom BusMvcEndpoint's for custom RemoteApplicationEvent's in our projects.

RabbitMQ exchanges not configured correctly

When starting a "blank" RabbitMQ and launching a Spring Cloud Config Server with spring-cloud-starter-bus-amqp on the classpath the exchanges in RabbitMQ are not configured properly.
Following exchanges are created:
springCloudBusOutput
springCloudBusInput

From springCloudBusInput there's a binding for each connected Cloud Bus Client. What is missing is the binding from springCloudBusOutput to the springCloudBusInput exchange. After adding this manually everything worked.
Is this by design or a misconfiguration on my side?

Custom Event Received but not handled by Event Handler

I did not write this original question, however I am encountering the same thing (except with Camden.SR3)...

http://stackoverflow.com/questions/40937359/spring-cloud-bus-custom-event-received-but-not-handled-by-event-handler?newreg=c399d359e366425f82d5b0e45b3d2157

I am using Spring Cloud Bus (1.2.1.RELEASE, Camden.SR2). I have a custom event (call it CustomEvent) that I have created and registered via @RemoteApplicationEventScan as well as a custom AbstractBusEndpoint implementation to publish the event. I am able to publish events to the bus just fine.
My remote application receives the event and acknowledges (I verified this using the trace endpoint). I have verified via debugging that the CustomEvent is published via the ApplicationEventPublisher provided in BusAutoConfiguration#acceptRemote. I have a bean with an event handler in my remote application (I have this auto-configured into all of my micro-services):
@component
public class EventListener {
@eventhandler(CustomEvent.class)
public void handleCustomEvent(CustomEvent event) {
..
}
}
Despite this, the event handler will not receive the event. I traced within the AbstractApplicationEventMulticaster class and despite my bean being created (verified via beans endpoint), the listener is not in the list of ApplicationListeners retrieved by ListenerRetriever. I do see the BusAutoConfiguration.acceptLocal listener in this list, but not my custom listener.
This event handler is also registered on the source application (the one I am accessing the bus endpoint from to initiate the event). The custom listener receives the event in this application, but not the remote application.
Essentially, both applications are configured the exact same except one is configured to send the CustomEvent using an implementation of AbstractBusEndpoint.
I am out of ideas of where else to look within the Spring code to debug this problem. If anyone has a thread they can lead me on it would be appreciated.

Add support for tracing bus events (acks)

It would be useful to be able to trace which instances of a service received which events. If services respond to a RemoteApplicationEvent they can send an ack, and the acks can be collected by a special service (or any service).

EnvironmentChangeListener not handle EnvironmentChangeRemoteApplicationEvent

Hi, I send an EnvironmentChangeRemoteApplicationEvent to Kafka, and saw the event received by consumer (through @EnableBinding(Sink.class) and @StreamListener(Sink.INPUT)) . But it didn't handle by EnvironmentChangeListener automatically.
In my mind, the listener should be setup if spring.cloud.bus.env.enabled=true and handle environment event that received. Is any other configuration I need add if I want to use the listener? Like some annotation? definition? Thanks

/bus/refresh not work in Camden.SR5

Hi, When I used the endpoints of /bus/refresh/ to refresh configuration on multiple instances(with rabbitmq), It does not work on Camden.SR5, I try the same code with Camden.SR4 and Camden.SR6, it works.

when I used Camden.SR5, I saw the rabbitmq created two exchanges:
springCloudBusInput
springCloudBusOutput

but when SR4 and SR6, it created one exchange only : springCloudBus

I see the Document did not find anything.

I see the code of class: org.springframework.cloud.bus.BusAutoConfiguration, the init method always gets the default destination for "springCloudBus".

Is there some bug in Camden.SR5?

Add license headers

There seem to be a lot of files having no header. Somebody should go through and add those.

can't override ServiceMatcher

org.springframework.cloud.bus.BusAutoConfiguration.MatcherConfiguration#serviceMatcher
it's protected and has no @ConditionalOnMissingBean on it

Exclude kafka broker from starter

Spring Cloud Stream 1.1 (Brooklyn) doesn't require the kafka broker on the classpath if you aren't using partitions. We could exclude it and save 10MB (approximately) from every client jar that uses the bus and kafka.

Allow graceful handling of unknown subtypes of RemoteApplicationEvent in acceptRemote()

BusAutoConfiguration.acceptRemote() https://github.com/spring-cloud/spring-cloud-bus/blob/master/spring-cloud-bus/src/main/java/org/springframework/cloud/bus/BusAutoConfiguration.java#L109 listens on RemoteApplicationEvents from the Spring Cloud Stream side. When subclassing RemoteApplicationEvent for broadcasting own business events, every application needs to know all subclasses that can be received from Spring Cloud Stream, else deserialization of the concrete subclass of RemoteApplicationEvent will fail. In a microservice setting, this forces updates to ALL services that participate on the bus for every new event subtype introduced to avoid deserialization exceptions in non-upgraded services, even if these services are not interested in those new events.

I propose to gracefully handle the case of non-deserializable event subtypes of RemoteApplicationEvent by discarding those messages.

Add documentation for /bus/refresh?destination API

We have successfully setup and configured a RabbitMQ instance + Spring Cloud Bus but wanted to test out only refreshing specific applications. In reading some stackoverflow posts [1] and looking through the source code the destination service appeared to be a capability. However, the documentation is lacking how to successfully leverage it. Through walking through the code with break points I was able to figure out that my application has a context id of <spring.application.name>:<spring.profiles.active> when issuing a curl request to curl -X POST localhost:8080/bus/refresh?destination=some-app%3Adev all applications with that name and profile active would then refresh.

[1] http://stackoverflow.com/questions/27230924/spring-cloud-configuration-recommended-architecture-in-data-center

Requires Actuator?

I've put together a trivial project which uses spring-cloud-starter-bus-amqp 1.0.0.RC1:

https://github.com/tomwhoiscontrary/BusSpike

Commit 2061bc644ace0fe87b71033a1c71b5ff6380b388 has the Cloud Bus starter and Actuator, and works - it builds and boots. However, if i remove the dependency on Actuator, boot fails like this:

https://gist.github.com/tomwhoiscontrary/748e4006ac2de424b241

Where i think the root cause is "java.lang.IllegalArgumentException: @ConditionalOnMissingBean annotations must specify at least one bean (type, name or annotation)", although i'm not at all sure.

The test fails in a corresponding way.

Does Cloud Bus require Actuator? If so, should there be an explicit dependency on it? If not, is there a bug to be fixed here? If not, is there something that i should change in my code, and which should be documented somewhere?

Can someone please provide a sample app using Spring Cloud Bus with Config Server and Spring Boot Client App

I have a Config Server and a Spring Boot Client app and I am trying to use Spring Cloud Bus for dynamic updates of configuration properties but not able to set it. I have RabbitMQ set on Linus box and these properties in application.properties file of Config Server

spring.rabbitmq.dynamic=true
spring.rabbitmq.host=server ip
spring.rabbitmq.port=5672
spring.rabbitmq.virtual-host=my-vhost
spring.rabbitmq.username=user1
spring.rabbitmq.password=password

and I also added spring-cloud-bus-parent, and spring-cloud-starter-bus-amqp dependency. What else do I need to do other than this. I am trying to create exchange and queue like this

@SpringBootApplication
@EnableConfigServer
public class ConfigServerApplication implements CommandLineRunner
{
    public static void main( String[] args )
    {
        SpringApplication.run(ConfigServerApplication.class, args);
    }

    @Bean
    Queue queue() {
        return new Queue("my-queue", false);
    }

    @Bean
    TopicExchange exchange() {
        return new TopicExchange("my-exchange");
    }

    @Bean
    Binding binding(Queue queue, TopicExchange exchange) {
        return BindingBuilder.bind(queue).to(exchange).with("my-queue");
    }

    @Autowired
    private Sender sender;

    @Override
    public void run(String... args) throws Exception {
        sender.sendToRabbitmq(new Object());
    }
}

@Service
class Sender {

    @Autowired
    private RabbitMessagingTemplate rabbitMessagingTemplate;
    @Autowired
    private MappingJackson2MessageConverter mappingJackson2MessageConverter;

    public void sendToRabbitmq(final Object o) {

        //this.rabbitMessagingTemplate.setMessageConverter(this.mappingJackson2MessageConverter);

        this.rabbitMessagingTemplate.convertAndSend("my-exchange", "my-queue", o);

    }

}

But when I start my Config Server app, it gives me this error:
Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no queue '8f223d29-53c5-4d79-b54e-395fe233c6f9' in vhost 'my-vhost', class-id=50, method-id=10)

I don't know what I am missing. Please help. Would be great if there is a sample app.

Applications specifying `server.port` do not receive refresh events

Can be reproduced with https://github.com/mstine/fortune-teller, following the steps in https://github.com/mstine/fortune-teller#testing-refresh (the ngrok part is not required though, relying on the refresh of a local git repository should suffice).

See https://github.com/spring-cloud/spring-cloud-bus/blob/master/spring-cloud-bus/src/main/java/org/springframework/cloud/bus/ServiceMatcher.java#L31.

The underlying cause is that the destinationService supplied by the event does not take into account the fact that the serviceId may include port information for applications that specify server.port explicitly. For the example above, when destinationService is *, it doesn't match ui:8081, which is the contextId of the fortune-teller-ui application.

Local events aimed at other services still get processed locally

The listeners (like RefreshListener) don't filter out local events aimed at remote services. Mostly that's harmless, but if we want to support RemoteApplicationEvent as a general purpose extension point for Bus apps we should tidy this up (maybe by doing the dispatch internally).

is JMS supported in addition to Kafka/RabbitMQ?

My company unfortunately never adopted AMQP-based messaging systems and I'm stuck with JMS... Is there a way to use it to propagate the /monitor changes of Github Enterprise changes?

If not, is there a direction I could take to implement that?

AMQP binding error (Brixton.M3)

I configured AMQP for centralized config and async communication between services. Considering moving over to Kafka for production. In the meantime this is blocking me. There seems to be a property binding error. See below.

POM Parent:

<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-parent</artifactId>
<version>Brixton.M3</version>
</parent>

Rabbit Config:

@Configuration
@EnableRabbit
@Profile("!" + Profiles.CLOUD)
public class RabbitConfig {

}
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.cloud.stream.binder.rabbit.default.CONFIGURATION_PROPERTIES': Could not bind properties to RabbitBinderConfigurationProperties (prefix=spring.cloud.stream.binder.rabbit.default, ignoreInvalidFields=false, ignoreUnknownFields=true, ignoreNestedProperties=false); nested exception is org.springframework.validation.BindException: org.springframework.boot.bind.RelaxedDataBinder$RelaxedBeanPropertyBindingResult: 4 errors

Field error in object 'spring.cloud.stream.binder.rabbit.default' on field 'requestHeaderPatterns': rejected value [STANDARD_REQUEST_HEADERS,*]; codes [typeMismatch.spring.cloud.stream.binder.rabbit.default.requestHeaderPatterns,typeMismatch.requestHeaderPatterns,typeMismatch.[Ljava.lang.String;,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [spring.cloud.stream.binder.rabbit.default.requestHeaderPatterns,requestHeaderPatterns]; arguments []; default message [requestHeaderPatterns]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.lang.String[]' for property 'requestHeaderPatterns'; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.lang.String to type java.lang.String[]]

Field error in object 'spring.cloud.stream.binder.rabbit.default' on field 'defaultDeliveryMode': rejected value [PERSISTENT]; codes [typeMismatch.spring.cloud.stream.binder.rabbit.default.defaultDeliveryMode,typeMismatch.defaultDeliveryMode,typeMismatch.org.springframework.amqp.core.MessageDeliveryMode,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [spring.cloud.stream.binder.rabbit.default.defaultDeliveryMode,defaultDeliveryMode]; arguments []; default message [defaultDeliveryMode]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'org.springframework.amqp.core.MessageDeliveryMode' for property 'defaultDeliveryMode'; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.lang.String to type org.springframework.amqp.core.MessageDeliveryMode]

Field error in object 'spring.cloud.stream.binder.rabbit.default' on field 'acknowledgeMode': rejected value [AUTO]; codes [typeMismatch.spring.cloud.stream.binder.rabbit.default.acknowledgeMode,typeMismatch.acknowledgeMode,typeMismatch.org.springframework.amqp.core.AcknowledgeMode,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [spring.cloud.stream.binder.rabbit.default.acknowledgeMode,acknowledgeMode]; arguments []; default message [acknowledgeMode]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'org.springframework.amqp.core.AcknowledgeMode' for property 'acknowledgeMode'; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.lang.String to type org.springframework.amqp.core.AcknowledgeMode]

Field error in object 'spring.cloud.stream.binder.rabbit.default' on field 'replyHeaderPatterns': rejected value [STANDARD_REPLY_HEADERS,*]; codes [typeMismatch.spring.cloud.stream.binder.rabbit.default.replyHeaderPatterns,typeMismatch.replyHeaderPatterns,typeMismatch.[Ljava.lang.String;,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [spring.cloud.stream.binder.rabbit.default.replyHeaderPatterns,replyHeaderPatterns]; arguments []; default message [replyHeaderPatterns]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.lang.String[]' for property 'replyHeaderPatterns'; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type java.lang.String to type java.lang.String[]]

Disabling bus system should disable further autoconfig

Propertys spring.cloud.bus.enabled and spring.cloud.bus.amqp.enabled are both enabled by default. If you set spring.cloud.bus.enabled=false, all other autoconfig classes are still doing their own stuff which is unnecessary and may lead to further errors.

Just an idea but what about if we create a new condition @OnBusEnabled which we could then embed to all other autoconfig classes not to proceed if bus is globally disabled.

Bus client with multiple active profiles does not match RemoteApplicationEvent

Transition this issue from spring-cloud-config
Please see spring-cloud/spring-cloud-config#678

copied the issue here for readbility

Current Github Repository structure is like so ...

test-config-server-repo/customerportal/

  • application.yml WORKS
  • customerportal.yml WORKS
  • application-dev.yml NOT WORK
  • customerportal-cloud.yml NOT WORK
  • customerportal-dev.yml NOT WORK

NOT WORK

On a change in customerportal-cloud.yml property we see the following RemoteRefreshApplicationEvent sent by the Spring Cloud Config Server

  {
    timestamp: 1490884282070,
    info: {
    signal: "spring.cloud.bus.sent",
    type: "RefreshRemoteApplicationEvent",
    id: "cac63deb-88b4-4762-b225-916eb44a40ff",
    origin: "pcfConfigServer:cloud:0",
    destination: "customerportal:cloud:**"
  }

On the client / consumer side the application context ID is
customerportal:dev,cloud:0

The client does not get notified of this remote event.

Notification does not work for any file that has the profile name in it.

WORKS

However when the following files change application.yml and customerportal.yml are modified the the RemoteRefreshEvent destination customerportal:** matched the applicationContextID of customerportal:dev,cloud:0 and the client/consumer apps are notified.

We have two active profiles for our consumer aka config client apps

  • dev
  • cloud

Clarify if spring-cloud-bus works with kafka

The intro for the README states:

The only implementation currently is with an AMQP broker as the transport....

The Quick Start section states:

 All you need to do to enable the bus is to add spring-cloud-starter-bus-amqp or spring-cloud-starter-bus-kafka to your dependency management and Spring Cloud takes care of the rest.

It is unclear if spring-cloud-bus works only with AMQP, or if it also works with kafka.

[RabbitMQ] Multiple connections consuming one queue

I am trying to setup the monitoring and pushing of config changes to clients on the spring cloud bus (http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html#_push_notifications_and_spring_cloud_bus). I have been able to successfully setup my config server along with a number of other applications. Within my RabbitMQ management UI I can see that there is multiple connections to RabbitMQ (one for each application):

rabbitmq-connections

As well I can see that the springCloudBus exchange has been setup:

rabbitmq-exchanges

As well a queue is setup for the springCloudBus:

rabbitmq-queues

rabbitmq-springcloudbus-queue-details

I have used RabbitMQ for couple other projects and something has me a bit confused. From my understanding the cloud bus is meant for applications to send events between each other. I see that is how the exchange has been setup with the "fanout" type. The problem I see is that the exchange is only fanning out the message to the one queue where all 8 consumers are listening. The message then is consumed by one of the connections and the remaining connections don't even know there was a message trying to be broadcast. This is what RabbitMQ classifies as a "Worker Queue" (http://www.rabbitmq.com/tutorials/tutorial-two-java.html). What I would have thought would be setup is more like the "Publish / Subscribe" model (http://www.rabbitmq.com/tutorials/tutorial-three-java.html). This would show up as each application have a temporary queue created and bound to the exchange such that the "fanout" would put a message into each queue and then each application can choose to act on the message or not.

Looking at the application logs for the config service I see that it identified that refresh for "hello-service" and broadcast that event but the logs within the hello-service show no message being received. I do see the message being sent through RabbitMQ as the exchange and queue shows an increment on the number of messages processed.

12/21 15:53:38.13 [APP|0] 2015-12-21 23:53:38.132  INFO 11 --- [nio-8080-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring FrameworkServlet 'dispatcherServlet'
12/21 15:53:38.13 [APP|0] 2015-12-21 23:53:38.133  INFO 11 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
12/21 15:53:38.16 [APP|0] 2015-12-21 23:53:38.161  INFO 11 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 28 ms
12/21 15:53:38.23 [APP|0] 2015-12-21 23:53:38.232  INFO 11 --- [nio-8080-exec-2] o.s.c.c.monitor.PropertyPathEndpoint     : Refresh for: hello-service
12/21 15:53:38.24 [APP|0] 2015-12-21 23:53:38.244  INFO 11 --- [nio-8080-exec-2] o.s.i.codec.kryo.CompositeKryoRegistrar  : registering [40, java.io.File] with serializer org.springframework.integration.codec.kryo.FileSerializer
12/21 15:53:38.27 [APP|0] 2015-12-21 23:53:38.271 DEBUG 11 --- [nio-8080-exec-2] o.s.a.r.c.CachingConnectionFactory       : Creating cached Rabbit Channel from AMQChannel(amqp://sclark@<AWS public IP>:5672/,2)
12/21 15:53:38.27 [APP|0] 2015-12-21 23:53:38.271 DEBUG 11 --- [nio-8080-exec-2] o.s.amqp.rabbit.core.RabbitTemplate      : Executing callback on RabbitMQ Channel: Cached Rabbit Channel: AMQChannel(amqp://sclark@<AWS public IP>:5672/,2)
12/21 15:53:38.27 [APP|0] 2015-12-21 23:53:38.272 DEBUG 11 --- [nio-8080-exec-2] o.s.amqp.rabbit.core.RabbitTemplate      : Publishing message on exchange [binder.topic.springCloudBus], routingKey = [null]
12/21 15:53:38.27 [APP|0] 2015-12-21 23:53:38.275 TRACE 11 --- [nio-8080-exec-2] o.s.a.r.c.CachingConnectionFactory       : Returning cached Channel: AMQChannel(amqp://sclark@<AWS public IP>:5672/,2)
12/21 15:53:38.68 [APP|0] 2015-12-21 23:53:38.689  INFO 11 --- [nio-8080-exec-2] nfigurationApplicationContextInitializer : Adding cloud service auto-reconfiguration to ApplicationContext
12/21 15:53:38.69 [APP|0] 2015-12-21 23:53:38.690  INFO 11 --- [nio-8080-exec-2] o.s.boot.SpringApplication               : Starting application on 8g3egh059ji with PID 11 (/home/vcap/app/lib/spring-boot-1.3.0.RELEASE.jar started by vcap in /home/vcap/app)
12/21 15:53:38.69 [APP|0] 2015-12-21 23:53:38.690  INFO 11 --- [nio-8080-exec-2] o.s.boot.SpringApplication               : The following profiles are active: lattice-aws,cloud
12/21 15:53:38.71 [APP|0] 2015-12-21 23:53:38.714  INFO 11 --- [nio-8080-exec-2] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@1c7f3c12: startup date [Mon Dec 21 23:53:38 UTC 2015]; root of context hierarchy
12/21 15:53:38.78 [APP|0] 2015-12-21 23:53:38.785  INFO 11 --- [nio-8080-exec-2] urceCloudServiceBeanFactoryPostProcessor : Auto-reconfiguring beans of type javax.sql.DataSource
12/21 15:53:38.78 [APP|0] 2015-12-21 23:53:38.789  INFO 11 --- [nio-8080-exec-2] urceCloudServiceBeanFactoryPostProcessor : No beans of type javax.sql.DataSource found. Skipping auto-reconfiguration.
12/21 15:53:38.79 [APP|0] 2015-12-21 23:53:38.793  INFO 11 --- [nio-8080-exec-2] bbitCloudServiceBeanFactoryPostProcessor : Auto-reconfiguring beans of type org.springframework.amqp.rabbit.connection.ConnectionFactory
12/21 15:53:38.79 [APP|0] 2015-12-21 23:53:38.795  INFO 11 --- [nio-8080-exec-2] bbitCloudServiceBeanFactoryPostProcessor : No beans of type org.springframework.amqp.rabbit.connection.ConnectionFactory found. Skipping auto-reconfiguration.
12/21 15:53:38.80 [APP|0] 2015-12-21 23:53:38.801  INFO 11 --- [nio-8080-exec-2] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
12/21 15:53:38.83 [APP|0] 2015-12-21 23:53:38.838  INFO 11 --- [nio-8080-exec-2] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$58db619] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
12/21 15:53:38.96 [APP|0] 2015-12-21 23:53:38.965  INFO 11 --- [nio-8080-exec-2] o.s.boot.SpringApplication               : Started application in 0.65 seconds (JVM running for 28.945)
12/21 15:53:39.38 [APP|0] 2015-12-21 23:53:39.387  INFO 11 --- [nio-8080-exec-2] nfigurationApplicationContextInitializer : Adding cloud service auto-reconfiguration to ApplicationContext
12/21 15:53:39.38 [APP|0] 2015-12-21 23:53:39.388  INFO 11 --- [nio-8080-exec-2] o.s.boot.SpringApplication               : The following profiles are active: lattice-aws,cloud
12/21 15:53:39.39 [APP|0] 2015-12-21 23:53:39.396  INFO 11 --- [nio-8080-exec-2] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@288d95a1: startup date [Mon Dec 21 23:53:39 UTC 2015]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@1c7f3c12
12/21 15:53:39.41 [APP|0] 2015-12-21 23:53:39.412  INFO 11 --- [nio-8080-exec-2] urceCloudServiceBeanFactoryPostProcessor : Auto-reconfiguring beans of type javax.sql.DataSource
12/21 15:53:39.41 [APP|0] 2015-12-21 23:53:39.416  INFO 11 --- [nio-8080-exec-2] urceCloudServiceBeanFactoryPostProcessor : No beans of type javax.sql.DataSource found. Skipping auto-reconfiguration.
12/21 15:53:39.41 [APP|0] 2015-12-21 23:53:39.419  INFO 11 --- [nio-8080-exec-2] bbitCloudServiceBeanFactoryPostProcessor : Auto-reconfiguring beans of type org.springframework.amqp.rabbit.connection.ConnectionFactory
12/21 15:53:39.42 [APP|0] 2015-12-21 23:53:39.420  INFO 11 --- [nio-8080-exec-2] bbitCloudServiceBeanFactoryPostProcessor : No beans of type org.springframework.amqp.rabbit.connection.ConnectionFactory found. Skipping auto-reconfiguration.
12/21 15:53:39.42 [APP|0] 2015-12-21 23:53:39.423  INFO 11 --- [nio-8080-exec-2] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
12/21 15:53:39.44 [APP|0] 2015-12-21 23:53:39.443  INFO 11 --- [nio-8080-exec-2] o.s.boot.SpringApplication               : Started application in 1.16 seconds (JVM running for 29.422)
12/21 15:53:39.44 [APP|0] 2015-12-21 23:53:39.444  INFO 11 --- [nio-8080-exec-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@288d95a1: startup date [Mon Dec 21 23:53:39 UTC 2015]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@1c7f3c12
12/21 15:53:39.44 [APP|0] 2015-12-21 23:53:39.446  INFO 11 --- [nio-8080-exec-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@1c7f3c12: startup date [Mon Dec 21 23:53:38 UTC 2015]; root of context hierarchy
12/21 15:53:40.88 [APP|0] 2015-12-21 23:53:40.880  INFO 11 --- [nio-8080-exec-2] o.s.c.n.eureka.InstanceInfoFactory       : Setting initial instance status as: STARTING
12/21 15:53:40.91 [APP|0] 2015-12-21 23:53:40.913  INFO 11 --- [nio-8080-exec-2] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_CONFIG-SERVICE/709924db-f872-4f89-4dbd-4f05b07fb7a5 - deregister  status: 200
12/21 15:53:40.93 [APP|0] 2015-12-21 23:53:40.936  INFO 11 --- [nio-8080-exec-2] c.n.e.EurekaDiscoveryClientConfiguration : Unregistering application config-service with eureka with status DOWN
12/21 15:53:40.95 [APP|0] 2015-12-21 23:53:40.955  INFO 11 --- [nio-8080-exec-2] c.n.d.provider.DiscoveryJerseyProvider   : Using encoding codec LegacyJacksonJson
12/21 15:53:40.95 [APP|0] 2015-12-21 23:53:40.955  INFO 11 --- [nio-8080-exec-2] c.n.d.provider.DiscoveryJerseyProvider   : Using decoding codec LegacyJacksonJson
12/21 15:53:41.26 [APP|0] 2015-12-21 23:53:41.262  INFO 11 --- [nio-8080-exec-2] c.n.d.provider.DiscoveryJerseyProvider   : Using decoding codec LegacyJacksonJson
12/21 15:53:41.26 [APP|0] 2015-12-21 23:53:41.262  INFO 11 --- [nio-8080-exec-2] c.n.d.provider.DiscoveryJerseyProvider   : Using encoding codec LegacyJacksonJson
12/21 15:53:41.39 [APP|0] 2015-12-21 23:53:41.391  INFO 11 --- [nio-8080-exec-2] com.netflix.discovery.DiscoveryClient    : Single vip registry refresh property : null
12/21 15:53:41.39 [APP|0] 2015-12-21 23:53:41.391  INFO 11 --- [nio-8080-exec-2] com.netflix.discovery.DiscoveryClient    : Disable delta property : false
12/21 15:53:41.39 [APP|0] 2015-12-21 23:53:41.391  INFO 11 --- [nio-8080-exec-2] com.netflix.discovery.DiscoveryClient    : Force full registry fetch : false
12/21 15:53:41.39 [APP|0] 2015-12-21 23:53:41.391  INFO 11 --- [nio-8080-exec-2] com.netflix.discovery.DiscoveryClient    : Application is null : false
12/21 15:53:41.39 [APP|0] 2015-12-21 23:53:41.391  INFO 11 --- [nio-8080-exec-2] com.netflix.discovery.DiscoveryClient    : Registered Applications size is zero : true
12/21 15:53:41.39 [APP|0] 2015-12-21 23:53:41.392  INFO 11 --- [nio-8080-exec-2] com.netflix.discovery.DiscoveryClient    : Getting all instance registry info from the eureka server
12/21 15:53:41.39 [APP|0] 2015-12-21 23:53:41.392  INFO 11 --- [nio-8080-exec-2] com.netflix.discovery.DiscoveryClient    : Application version is -1: true
12/21 15:53:41.40 [APP|0] 2015-12-21 23:53:41.401  INFO 11 --- [nio-8080-exec-2] com.netflix.discovery.DiscoveryClient    : The response status is 200
12/21 15:53:41.40 [APP|0] 2015-12-21 23:53:41.404  INFO 11 --- [nio-8080-exec-2] com.netflix.discovery.DiscoveryClient    : Starting heartbeat executor: renew interval is: 30
12/21 15:53:41.40 [APP|0] 2015-12-21 23:53:41.404  INFO 11 --- [nio-8080-exec-2] c.n.discovery.InstanceInfoReplicator     : InstanceInfoReplicator onDemand update allowed rate per min is 4
12/21 15:53:41.40 [APP|0] 2015-12-21 23:53:41.406  INFO 11 --- [nio-8080-exec-2] c.n.e.EurekaDiscoveryClientConfiguration : Registering application config-service with eureka with status UP
12/21 15:53:41.40 [APP|0] 2015-12-21 23:53:41.407  WARN 11 --- [nio-8080-exec-2] com.netflix.discovery.DiscoveryClient    : Saw local status change event StatusChangeEvent [current=UP, previous=DOWN]
12/21 15:53:41.40 [APP|0] 2015-12-21 23:53:41.408  INFO 11 --- [nio-8080-exec-2] o.s.cloud.bus.event.RefreshListener      : Received remote refresh request. Keys refreshed []
12/21 15:53:41.42 [APP|0] 2015-12-21 23:53:41.421  INFO 11 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_CONFIG-SERVICE/709924db-f872-4f89-4dbd-4f05b07fb7a5: registering service...
12/21 15:53:41.44 [APP|0] 2015-12-21 23:53:41.449  INFO 11 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_CONFIG-SERVICE/709924db-f872-4f89-4dbd-4f05b07fb7a5 - registration status: 204
12/21 15:53:41.32 [RTR|0] config-service.<AWS public IP>.xip.io - [21/12/2015:23:53:37 +0000] "POST /monitor HTTP/1.1" 200 18 17 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36" 159.153.136.64:59959 x_forwarded_for:"-" x_forwarded_proto:"-" vcap_request_id:85a5b087-f50a-403d-437e-5f8ed98af136 response_time:3.358991989 app_id:config-service

12/21 15:53:42.01 [APP|0] 2015-12-21 23:53:42.016  INFO 11 --- [nio-8080-exec-3] o.s.boot.SpringApplication               : Starting application on 8g3egh059ji with PID 11 (/home/vcap/app/lib/spring-boot-1.3.0.RELEASE.jar started by vcap in /home/vcap/app)
12/21 15:53:42.01 [APP|0] 2015-12-21 23:53:42.016  INFO 11 --- [nio-8080-exec-3] o.s.boot.SpringApplication               : The following profiles are active: lattice-aws,cloud
12/21 15:53:42.02 [APP|0] 2015-12-21 23:53:42.024  INFO 11 --- [nio-8080-exec-3] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@23d7e3ae: startup date [Mon Dec 21 23:53:42 UTC 2015]; root of context hierarchy
12/21 15:53:42.05 [APP|0] 2015-12-21 23:53:42.052  INFO 11 --- [nio-8080-exec-3] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
12/21 15:53:42.06 [APP|0] 2015-12-21 23:53:42.062  INFO 11 --- [nio-8080-exec-3] o.s.boot.SpringApplication               : Started application in 0.695 seconds (JVM running for 32.041)
12/21 15:53:42.06 [APP|0] 2015-12-21 23:53:42.064  INFO 11 --- [nio-8080-exec-3] o.s.c.c.s.e.NativeEnvironmentRepository  : Adding property source: file:/home/vcap/app/C:/Users/sclark/AppData/Local/Temp/config/application.yml#lattice-aws
12/21 15:53:42.06 [APP|0] 2015-12-21 23:53:42.064  INFO 11 --- [nio-8080-exec-3] o.s.c.c.s.e.NativeEnvironmentRepository  : Adding property source: file:/home/vcap/app/C:/Users/sclark/AppData/Local/Temp/config/hello-service.yml
12/21 15:53:42.06 [APP|0] 2015-12-21 23:53:42.064  INFO 11 --- [nio-8080-exec-3] o.s.c.c.s.e.NativeEnvironmentRepository  : Adding property source: file:/home/vcap/app/C:/Users/sclark/AppData/Local/Temp/config/application.yml
12/21 15:53:42.06 [APP|0] 2015-12-21 23:53:42.065  INFO 11 --- [nio-8080-exec-3] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@23d7e3ae: startup date [Mon Dec 21 23:53:42 UTC 2015]; root of context hierarchy

Based on this I am currently stuck on trying to get the config server to broadcast out any changes. If there is any additional logging that you would like me to include to give more details then please let me know and I can provide them.

Github Webhook, RefreshRemoteApplicationEvents, on Load-balanced Config Servers

Setup

We have load-balanced our Config Servers to support multiple teams across our organization. That way, we have a centralized Configuration Service that uses the Multi-git repos support where services need to onboard and specify their Github Enterprise Org/Repo path and app name. So, when dealing with config-server.mycompany.net:8888, the app services can be talking to any of the config servers.

Question

  • Question for @spencergibb, based on https://spencer.gibb.us/blog/2015/09/24/spring-cloud-config-push-notifications/, is there a way to use the same strategy of using the Github Webhook and the Cloud Bus to distribute the message Webhook Event to all Config Servers?
  • What are the consequences of using the Bus for this scenario, given that all Config servers will try to send Push Notification to all the client apps using the RefreshRemoteApplicationEvents (delivered through Spring Cloud Bus with RabbitMQ or other transport)?

thanks a lot for any help!

Spring Cloud Bus broken with Dalston.RC1 and Spring Boot 1.5.2.RELEASE on MacOSX

The next configuration: Dalston.RC1 and Spring Boot 1.5.2.RELEASE.

POSTing to /bus/refresh will not refresh other services (only the service on which /bus/refresh is called is refreshed).

buildscript {
	ext {
		springBootVersion = '1.5.2.RELEASE'
		gradleDockerVersion = '1.2'
	}
	repositories {
		mavenCentral()
	}
	dependencies {
		classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
		classpath("se.transmode.gradle:gradle-docker:${gradleDockerVersion}")
		classpath("io.spring.gradle:dependency-management-plugin:0.5.2.RELEASE")
	}
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'idea'
apply plugin: 'docker'
apply plugin: "io.spring.dependency-management"

version = '0.0.1'
sourceCompatibility = 1.8
targetCompatibility = 1.8

jar {
	baseName = 'ms-fake-microservice'
	version = "${project.version}"
}

repositories {
	mavenCentral()
	maven { url "https://repo.spring.io/milestone" }
	maven { url "https://repo.spring.io/snapshot" }
}

dependencies {
	compile('org.springframework.boot:spring-boot-starter-actuator')
	compile('org.springframework.boot:spring-boot-starter-web')
	compile('org.springframework.cloud:spring-cloud-starter-config')
	compile('org.springframework.cloud:spring-cloud-starter-bus-amqp')
	runtime('org.springframework.boot:spring-boot-devtools')
	testCompile('org.springframework.boot:spring-boot-starter-test')
}

dependencyManagement {
	imports {
		mavenBom "org.springframework.cloud:spring-cloud-dependencies:Dalston.RC1"
		mavenBom 'org.springframework.cloud:spring-cloud-stream-dependencies:Chelsea.RC1'
		mavenBom 'org.springframework.cloud:spring-cloud-bus:1.3.0.M1'
	}
}

group = 'microsip'

/*
docker {
	baseImage "microsip/oracle-jdk:1.8_112"
	maintainer 'Juan Francisco Alvarez Urquijo <[email protected]>'
}
*/

/**
 * Generic support for building docker images for SpringBoot Apps
 */
task buildDocker(type: Docker, dependsOn: build) {
	push = project.hasProperty('push')
	applicationName = rootProject.name
	dockerfile = file('src/main/docker/Dockerfile')

	doFirst {
		// Rename the app jar to "app.jar" so that the Dockerfile does not require renames
		copy {
			from "${project.buildDir}/libs"
			into stageDir
			include "${rootProject.name}-${version}.jar"
			rename("${rootProject.name}-${version}.jar", "app.jar")
		}
	}

	doLast {
		println "Run the Docker Container"
		println "docker run -ti -p 8080:8080 $project.group/$applicationName:$version"
	}
}

// @see https://github.com/spring-projects/spring-boot/issues/832
bootRun {
	systemProperties = System.properties
}

Add Gateway routes refresh support

We're using a config server and Spring Cloud Bus to distribute a RefreshRemoteApplicationEvent. This works fine so far.
When our Zuul Proxy receives the event with changed routes they don't get loaded.
I've solved this by adding my own RefreshListener which does the following:
zuulHandlerMapping.setDirty(true);

After adding this the refresh works fine and new routes are added.

We're on Cameden SR5.
It's quite a simple setup.
One config server.
One Zuul server.
One RabbitMQ.

To reproduce add a route to the config and invoke the /monitor endpoint on the configserver.
The Zuul gets triggered but the routes are not changed.

If you need any further information feel free to ask anytime.

RefreshListener doesn't respect destination service

When a service is receiving a RemoteApplicationRefreshEvent the destinationServiceId isn't checked. Every application does refresh it's context. Would be great to only refresh the applications that match the given destinationServiceId.

Or is the current behaviour correct?

Problem using org.springframework.cloud.stream.binder.rabbit.RabbitMessageChannelBinder to set up the subscribers on the Spring Cloud Bus

I have a system with three components. A ConfigServer, ServiceA, and ServiceB. When they register against the Spring Cloud Bus, they all end up being tied as consumers to the same queue registered against the binder.springCloudBus queue. This causes round-robining of messages, where only one service will actually be delivered a notification on the bus.

In RabbitMessageChannelBinder.bindPubSubConsumer(String name, MessageChannel moduleInputChannel, Properties properties), it is not possible to give each queue a different name and have it bound to the same exchange.

ConfigServer -----------------
                             |
                    ------------------
ServiceA ---------- | SpringCloudBus |
                    ------------------
                             |
ServiceB ---------------------

Exchange: binder.topic.springCloudBus
Queue: binder.springCloudBus

The SINGLE queue ends up with three consumers.

This was discovered when we were working with the /refresh capabilities of spring-cloud. In the scenario above, the refresh message is not passed to all necessary parties.

Add support for /bus/pause and /bus/resume endpoints

The same way we have /bus/refresh it might be useful to have /bus/pause and /bus/resume.
My use case was already mention on Spring Cloud Config:
The ability to stop message listener containers to turn the app into read only mode.
That can be done by sending a pause event, then Rabbit containers stop getting messages.
But with the Cloud Bus will be possible to send an event to all my consumers at once.

Thanks.

Inbound filter question

The inbound filter, defined in BusAutoConfiguration.inboundFilter(), includes the condition

!serviceMatcher().isFromSelf(event)

This seems to ensure that processes running the same app won't be able to communicate through the bus. Why is this? Wouldn't it make sense for apps to be able to send each other messages through the bus? Or am I missing something?

It also means that one has to invoke /bus/refresh on a separate app (e.g. on a config server with the bus enabled). Invoking it on one of the processes for the app in a cluster results in only that process being refreshed, because because it handles the context level event. The processes will filter out the refresh event.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.