spring-integration

Spring Integration: TCP Client/Server opening one client connection per server connection

帅比萌擦擦* 提交于 2019-12-06 15:40:15
I'm trying to implement a TCP client/server application with Spring Integration where I need to open one TCP client socket per incoming TCP server connection. Basically, I have a bunch of IoT devices that communicate with a backend server over raw TCP sockets. I need to implement extra features into the system. But the software on both the devices and the server are closed source so I can't do anything about that. So my thought was to place middleware between the devices and the server that will intercept this client/server communication and provide the added functionality. I'm using a

Http Gateways and Json Transformers: stripped headers

不打扰是莪最后的温柔 提交于 2019-12-06 15:38:33
Using Spring Integration 4.0.3.RELEASE with Jackson2, I am trying to use Json Transformers in conjunction with http gateways. My pathway looks akin to that of the amqp adapter referenced in the Spring Integration documentation but with http gateways(1): ...->object-to-json-transformer->http-outbound-gateway----> ---->http-inbound-gateway->json-to-object-transformer-> Client: <int:chain id="messageTransformerChain" input-channel="toServer" output-channel="messagesToServer"> ... <int:object-to-json-transformer /> </int:chain> <int-http:outbound-gateway id="httpOutToSever" request-channel=

@MessagingGateway, Spring Cloud Stream, and error handling across both

此生再无相见时 提交于 2019-12-06 14:29:26
问题 Regarding the answer posted for How can @MessagingGateway be configured with Spring Cloud Stream MessageChannels?, what is the correct way to handle errors at the @MessagingGateway that can be returned from Spring Cloud Stream services? To recap, I have a @MessagingGateway that provides synchronous access to asynchronous services built using Spring Cloud Stream. When an error occurs within my Spring Cloud Stream service layer, I create an error response and send it through a

Spring Integration - transformer and header enricher

筅森魡賤 提交于 2019-12-06 14:24:10
My case is like this: I need to route a message based on the zipcode to three different stores. For that I need to look at the message header to find the customer's zipcode, and do the following calculation: if(zip < 5000) { store = "SJ"; } else if(zip >= 6000) { store = "JY"; } else { store = "FY"; } I have managed to get it done using the following custom Transformer which I use to enrich the message header: public class HeaderEnricher { public Message<?> transform(Message<?> message) { int zip = message.getHeaders().get("Customer Zip", Integer.class); String store; if (zip < 5000) { store =

Spring Integration File reading

佐手、 提交于 2019-12-06 13:29:19
I am newbie to Spring Integration. I am working on solution, but I am stuck on a specific issue while using inbound file adapter ( FileReadingMessageSource ). I have to read files from different directories and process them and save the files in different directories. As I understand, the directory name is fixed at the start of the flow. Can some one help me on changing the directory name for different requests. I attempted the following. First of all, I am not sure whether it is correct way to about and although it worked for only one directory. I think Poller was waiting for more files and

Subset of changes from transaction sometimes not visible shortly after commit

左心房为你撑大大i 提交于 2019-12-06 12:19:03
问题 Let's consider the following context: 2 spring integration channels, they are each in separate database transactions. At the end of the first transaction, a message is put into the second channel. In the first channel, elements are created in the database that is later consumed by the corresponding message that has been sent from the first channel to the second channel. To make sure that the transaction from channel 1 is fully committed before the second channel is triggered our subclass of

How is jms session handled in a flow containing inbound adapter, outbound adapter, error channel and configured with same CachingConnectionfactory

烈酒焚心 提交于 2019-12-06 08:57:16
I have the following flow: 1) message-driven-channel-adapter -> 1.1) output-channel connected to -> service-activator -> outbound-channel-adapter (for sending response) 1.2) error-channel connected to -> exception-type-router 1.2.1) message is sent to different queues depending on the exception type using outbound-channel-adapter MessageDrivenChannelAdapter uses DefaultMessageListenrContainer and OutboundAdapter uses JMSTemplate Have used same cachingconnectionfactory for inbound and outbound adapters, set acknowledge="transacted" in messageDrivenChannelAdapter set cacheLevel as CACHE_CONSUMER

Spring Integration - writing to a error queue when Exception happended in a Service Activator component

我的未来我决定 提交于 2019-12-06 08:44:40
问题 I'm starting to use Spring integration and I don't know how to resolve this situation if it's possible. I would like to 'catch' automatically every Exception who could happend in the service activators of my application and send this errors to a dedicated queue. Gateway is not a solution because I need some custom code so I have to use service activator elements if I have correctly understood the principle. I thought that something like would be ok: <jms:outbound-channel-adapter channel=

Set Spring Integration header value to bean property

前提是你 提交于 2019-12-06 08:18:43
Is there anyway to set value of spring integration header to bean property. <int:header-enricher> <int:header name="bId" expression="T(java.util.UUID).randomUUID()" /> </int:header-enricher> Now in bean definition <bean id="" class=""> <property name="bId" value="#{headers['bId']}" /> </bean> This above code doesn't work. this throws exception Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field 'headers' cannot be found on object of type 'org.spri ngframework.beans.factory.config.BeanExpressionContext' - maybe not public? I tried below

How-to make an arbitrary part of a message flow (pseudo) transactional?

孤街浪徒 提交于 2019-12-06 08:10:18
I would like to make a flow initiated by syslog inbound-channel-adapter messages transactional. Unfortunately the adapter does not take a poller which could be made transactional (the typical approach used in many examples with other inbound adapters). Is there any workaround? EDIT After some thinking I realized that my intent is a little different than initially described (hence change of the title). Basically all I want to do is some simple and straight-forward way of making an arbitrary part (starting from some arbitrary channel in the flow) of my message flow pseudo-transactional. Meaning