spring-dsl

Load spring beans from custom groovy files in grails app

青春壹個敷衍的年華 提交于 2019-12-19 16:35:42
问题 Trying to load spring beans from custom groovy file in Grails 2.3.7. I know this question has been asked before, but after hours of searching, I'm unable to find a consistent approach that loads from the classpath. The Goal Modularize resources.groovy into multiple custom resource files Put custom resource files in standard location: grails-app/conf/spring Use plugin to do the magic; minimize overhead Tried... //## grails-app/conf/spring/MyBeansConfig.groovy beans { testsvc(TestService){ msg

How to create a DSL Groovy config file using an arbitrary Map (dynamic object)

怎甘沉沦 提交于 2019-12-14 03:27:34
问题 How do I convert an arbitrary Groovy map / list to the config style DSL syntax that Groovy provides? Example: def config = [ 'test': 'lalala', 'nestedObject': [ foo1: 'foo1 val', foo2: 'foo2 val', nested2: [ anInt: 5, anArray: ['a', 'b', 'c'], anIntArray: [1, 2, 3] ] ] ] To something like: test = 'lalala' nestedObject { foo1 = 'foo1 val' foo2 = 'foo2 val' nested2 { anInt = 5 anArray = ['a', 'b', 'c'] anIntArray = [1, 2, 3] } } UPDATE: Re-appropriating this post to explicitly ask for a dynamic

Give Priority to SFTP Remote Directories

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 01:44:04
问题 Using single SFTP channel I need to process two remote directories lowpriority and highprioiry but lowpriority files pick after the highpriority . please let know how handle multiple directories in SFTP inbound adapter with single channel ? We can do using https://docs.spring.io/spring-integration/reference/html/sftp.html#sftp-rotating-server-advice Rotation Service advice in Spring 5.1.2 Release but what about 4.3.12 Release.? 回答1: It is not available in 4.3.x; the feature was added in 5.0.7

Spring Integration 4 - configuring a LoadBalancingStrategy in Java DSL

冷暖自知 提交于 2019-12-13 01:29:49
问题 I have a simple Spring Integration 4 Java DSL flow which uses a DirectChannel 's LoadBalancingStrategy to round-robin Message requests to a number of possible REST Services (i.e. calls a REST service from one of two possible service endpoint URIs). How my flow is currently configured: @Bean(name = "test.load.balancing.ch") public DirectChannel testLoadBalancingCh() { LoadBalancingStrategy loadBalancingStrategy = new RoundRobinLoadBalancingStrategy(); DirectChannel directChannel = new

Spring Integration | Java DSL

江枫思渺然 提交于 2019-12-12 01:17:33
问题 I want to send a file to SFTP server. I have created a outbound flow for it @Bean public IntegrationFlow sftpOutboundFlow() { return IntegrationFlows .from("toSftpChannel") .handle(Sftp.outboundAdapter(this.smileCachedSftpSessionFactory, FileExistsMode.REPLACE) .charset(Charset.forName(fileEncoding)).remoteFileSeparator("/") .remoteDirectory(remoteDirectory).fileNameExpression("payload.getName()") .autoCreateDirectory(true).useTemporaryFileName(true).temporaryFileSuffix(".tranferring")) .get(

Spring boot integration mail - authorization failed error

与世无争的帅哥 提交于 2019-12-11 16:07:55
问题 Following is my spring configuration bean for pop3 connection, @Bean public IntegrationFlow mailListener() { return IntegrationFlows.from(Mail.pop3InboundAdapter("pop3://sample.test:Sample2test_1@xxx.xx.x.xx/INBOX") .shouldDeleteMessages(true).get(), e -> e.poller(Pollers.fixedRate(5000).maxMessagesPerPoll(1))) .<Message>handle((payload, header) -> logMail(payload)) .get(); } Also double checked the credentials that looks good. Getting the below exception, 2018-06-22 19:27:54.351 ERROR 2092 -

How to aggregate one message into multiple group with camel aggregate?

萝らか妹 提交于 2019-12-11 10:46:42
问题 I'm trying to generate a aggregate view of consecutive market data, which means we need to calculate the sum value every 2 message. say the data coming in as: (V0,T0),(V1,T1),(V2,T2),(V3,T3).... V means value T means timestamp when we receive the data. We need to generate the sum for every 2 points say: (R1=Sum(V0,V1),T1),(R2=Sum(V1,V2),T2),(R3=Sum(V2,V3),T3),.... Any suggestion how can we do this by using aggregator2 or we need to write a processor for this? 回答1: You are right, aggregator2

How to create ConfigObject using only nested maps in Grails?

萝らか妹 提交于 2019-12-11 08:15:46
问题 It is possible to implement closure-based config as a map of maps? grails { acme { host = 'localhost' poolSettings { timeout = 5000 } } } The above config is convention for a grails plugin. We're doing a migration, and due to legacy constraints, we need to create the config dynamically to eliminate impact to legacy code. I started with a simple config: grails.acme = [host:'localhost'] This works fine with the plugin on startup, so I added a nested map: grails.acme = [host:'localhost'] def

Spring Integration with Jackson ObjectMapper and Java 8 Time (JSR-310)

倖福魔咒の 提交于 2019-12-02 01:08:18
I am struggling with configuring a "custom" ObjectMapper to be used by the Spring Integration DSL transformers. I receive an java.time.Instant json representations that I would like to parse to object properties. i.e: {"type": "TEST", "source":"TEST", "timestamp":{"epochSecond": 1454503381, "nano": 335000000}} The message is a kafka message which raises a question: Should I write a custom serializer implementing Kafka encoders/decoders in order to be able to transform the kafka message to the right object or spring-integration have to do this automatically? fw/dependencies and version: Spring

Load spring beans from custom groovy files in grails app

余生长醉 提交于 2019-12-01 17:01:20
Trying to load spring beans from custom groovy file in Grails 2.3.7. I know this question has been asked before, but after hours of searching, I'm unable to find a consistent approach that loads from the classpath. The Goal Modularize resources.groovy into multiple custom resource files Put custom resource files in standard location: grails-app/conf/spring Use plugin to do the magic; minimize overhead Tried... //## grails-app/conf/spring/MyBeansConfig.groovy beans { testsvc(TestService){ msg = 'hello' } } Note above, I'm using beans {} , not beans = {} , apparently it makes a difference: