Hi,
I am building a client-server model using Spring Integration.
I am using direct channel.
My system works as:
1.Receive request on servlet
2.Get the message channel
3.Write response in servlet response channel.
The problem arises when i receive multiple requests at the same time.
Spring Integration processes the request one by one.
It takes the first request, processes it, writes the response and then picks up the next request.My request channel is getting locked.
My servlet code is as follows:
Only one instance of the request channel is created.Code:private void doSpringIntegrationHandling(HttpServletRequest request, HttpServletResponse response) throws IOException { ApplicationContext applicationContext = WebApplicationContextUtils .getRequiredWebApplicationContext(getServletContext()); String data = readBody(request); readQueryString(request); MessageChannel requestChannel = (MessageChannel) applicationContext .getBean("deviceRequestChannel"); MessageBuilder<?> messageBuilder = MessageBuilder.withPayload(data).setHeader("response", response); log.info("RESPONSE OBJECT -- "+response); requestChannel.send(messageBuilder.build());
My config is as follows:
I used httpinboundgateway but faced some issues while reading the data written in request.Code:<int:channel id="deviceRequestChannel" /> <int:channel id="deviceResponseChannel" >
I don't want to use a queue here.Need to open a new channel for each request?
Is it possible?Please help.
Thanks in advance.
Regards,
Annuk![]()


Reply With Quote
