-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit restructures the cloud messaging group by removing binder specific checkbox for Spring Cloud Bus and Spring Cloud Stream. A new "Messaging" group is added with RabbitMQ, Kafka and JMS. To create a new cloud messaging project, the user should now select the technology and a binder. To support Spring Cloud Stream with Kafka streams, a dedicated "Kafka Streams" has been introduced. Closes gh-557
- Loading branch information
Showing
4 changed files
with
327 additions
and
83 deletions.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
...java/io/spring/initializr/service/extension/SpringCloudMessagingRequestPostProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright 2012-2018 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.spring.initializr.service.extension; | ||
|
||
import io.spring.initializr.generator.ProjectRequest; | ||
import io.spring.initializr.metadata.Dependency; | ||
import io.spring.initializr.metadata.InitializrMetadata; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
/** | ||
* Determine the appropriate Spring Cloud stream dependency to use based on the | ||
* selected messaging technology. | ||
* <p> | ||
* Does not replace the messaging technology jar by the relevant binder. If more than | ||
* one tech is selected, it is far more easier to remove the unnecessary binder jar than | ||
* to figure out the name of the tech jar to add to keep support for that technology. | ||
* | ||
* @author Stephane Nicoll | ||
*/ | ||
@Component | ||
public class SpringCloudMessagingRequestPostProcessor | ||
extends AbstractProjectRequestPostProcessor { | ||
|
||
static final Dependency KAFKA_BINDER = Dependency.withId("cloud-stream-binder-kafka", | ||
"org.springframework.cloud", "spring-cloud-stream-binder-kafka"); | ||
|
||
static final Dependency RABBIT_BINDER = Dependency.withId( | ||
"cloud-stream-binder-rabbit", "org.springframework.cloud", | ||
"spring-cloud-stream-binder-rabbit"); | ||
|
||
@Override | ||
public void postProcessAfterResolution(ProjectRequest request, | ||
InitializrMetadata metadata) { | ||
boolean hasSpringCloudStream = hasDependency(request, "cloud-stream"); | ||
boolean hasReactiveSpringCloudStream = hasDependency(request, | ||
"reactive-cloud-stream"); | ||
boolean hasSpringCloudBus = hasDependency(request, "cloud-bus"); | ||
boolean hasSpringCloudTurbineStream = hasDependency(request, | ||
"cloud-turbine-stream"); | ||
if (hasSpringCloudStream || hasReactiveSpringCloudStream || hasSpringCloudBus | ||
|| hasSpringCloudTurbineStream) { | ||
if (hasDependencies(request, "amqp")) { | ||
request.getResolvedDependencies().add(RABBIT_BINDER); | ||
} | ||
if (hasDependencies(request, "kafka")) { | ||
request.getResolvedDependencies().add(KAFKA_BINDER); | ||
} | ||
} | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.