Rename samples

This commit is contained in:
Ilayaperumal Gopinathan
2020-06-24 21:00:13 +05:30
parent cc3191ace4
commit 36648a23ba
26 changed files with 7 additions and 4 deletions

View File

@@ -0,0 +1,57 @@
/*
* Copyright 2019-2020 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 org.springframework.cloud.stream.app.log.sink.rabbit;
import java.util.function.Consumer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.fn.consumer.log.LogConsumerProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.integration.dsl.IntegrationFlow;
import org.springframework.integration.dsl.IntegrationFlows;
import org.springframework.messaging.Message;
@SpringBootApplication
@Import({ org.springframework.cloud.fn.consumer.log.LogConsumerConfiguration.class })
public class LogSinkRabbitApplication {
@Bean
IntegrationFlow logConsumerFlow2(LogConsumerProperties logSinkProperties) {
return IntegrationFlows.from(MessageConsumer.class, (gateway) -> gateway.beanName("logConsumer2"))
.handle((payload, headers) -> payload)
.log(logSinkProperties.getLevel(), logSinkProperties.getName(), logSinkProperties.getExpression())
.get();
}
@Bean
IntegrationFlow logConsumerFlow3(LogConsumerProperties logSinkProperties) {
return IntegrationFlows.from(MessageConsumer.class, (gateway) -> gateway.beanName("logConsumer3"))
.handle((payload, headers) -> payload)
.log(logSinkProperties.getLevel(), logSinkProperties.getName(), logSinkProperties.getExpression())
.get();
}
private interface MessageConsumer extends Consumer<Message<?>> {
}
public static void main(String[] args) {
SpringApplication.run(LogSinkRabbitApplication.class, args);
}
}

View File

@@ -0,0 +1 @@
configuration-properties.classes=org.springframework.cloud.fn.consumer.log.LogConsumerProperties

View File

@@ -0,0 +1,16 @@
spring.application.name=${vcap.application.name:log-sink}
info.app.name=@project.artifactId@
info.app.description=@project.description@
info.app.version=@project.version@
management.endpoints.web.exposure.include=health,info,bindings
spring.cloud.stream.function.definition=byteArrayTextToString|logConsumer;byteArrayTextToString|logConsumer2;byteArrayTextToString|logConsumer3
spring.cloud.stream.function.bindings.byteArrayTextToString|logConsumer-in-0=input1
spring.cloud.stream.function.bindings.byteArrayTextToString|logConsumer2-in-0=input2
spring.cloud.stream.function.bindings.byteArrayTextToString|logConsumer3-in-0=input3

View File

@@ -0,0 +1,32 @@
/*
* Copyright 2019-2020 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 org.springframework.cloud.stream.app.log.sink.rabbit;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class LogSinkRabbitApplicationTests {
@Test
public void contextLoads() {
}
}