forked from spring-io/initializr
-
Notifications
You must be signed in to change notification settings - Fork 1
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 spring-iogh-557
- Loading branch information
Showing
4 changed files
with
337 additions
and
81 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
...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,70 @@ | ||
/* | ||
* 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. | ||
* | ||
* @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 KAFKA_STREAMS_BINDER = Dependency.withId( | ||
"cloud-stream-binder-kafka-streams", "org.springframework.cloud", | ||
"spring-cloud-stream-binder-kstream"); | ||
|
||
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"); | ||
if (hasSpringCloudStream || hasReactiveSpringCloudStream || hasSpringCloudBus) { | ||
if (hasDependencies(request, "amqp")) { | ||
request.getResolvedDependencies().add(RABBIT_BINDER); | ||
} | ||
if (hasDependencies(request, "kafka")) { | ||
request.getResolvedDependencies().add(KAFKA_BINDER); | ||
} | ||
} | ||
// Spring Cloud Stream specific | ||
if (hasSpringCloudStream || hasReactiveSpringCloudStream) { | ||
if (hasDependencies(request, "kafka-streams")) { | ||
request.getResolvedDependencies().add(KAFKA_STREAMS_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.