JSF2.0 #Viewscoped beans not replicating in clustered environment - jsf-2

Deployed JSF2.0 in the cluster environment on Apache tomcat server. How to replicate view scoped beans in the clustered environment?
Most of the beans are in viewscoped and state saving method is client.
The problem is : when I opened Home.xhtml first request goes to node 1. View-scoped bean was created. Clicked on action button for processing and loading the same view now request goes to node 2 - where the view doesn't exist.JSF creating new viewscoped bean, this is where I am loosing my previous state in node1.
On the other hand JSF view-state may not work properly in cluster environment. How to use JSF2 in clustered environment?
Are there any other solutions other than session replication and sticky session?

JSF viewscope, client state saving, can work in cluster environment if the application post entire request in a single request,Do not try to send partial page request.
If you change some of the fields in UI will be replicated in the server by JSF because you are sending the entire state instead of partial state.

Related

Spring Rabbit - How to recover rabbit topology for Declarables (queues/bindings/exchanges) that are not beans (when rabbit server restarts)

I use a Spring Boot application with spring-rabbit (version 2.2.2). Since the nature of my application is very dynamic, the queues and bindings are declared dynamically using RabbitAdmin.declareXXX methods, so they are not declared as Spring Beans.
From my understanding (and testing), the RabbitAdmin's functionality for auto-recovery the topology when rabbitmq server restarts is only for exchanges/queues/bindings that were declared as Spring Beans (am I correct?).
I tried to use the underlying Rabbit client's auto recovery feature using the following methods:
cachingConnectionFactory.getRabbitConnectionFactory().setAutomaticRecoveryEnabled(true)
cachingConnectionFactory.getRabbitConnectionFactory().setTopologyRecoveryEnabled(true)
However, after the rabbitmq server restart, the spring application fails with:
One org.springframework.amqp.rabbit.connection.AutoRecoverConnectionNotCurrentlyOpenException
And multiple continuous com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reploy-code=404, reply-text=NOT_FOUND - no queue 'recovery-q1' in host '/'
and nothing is getting recovered.
Note that a test without Spring, where the queue is created directly through the channel, the queue is recovered properly with its consumers.
Is there anything else I can configure to make this work?
Currently, spring only recovers Declarables that are defined as beans in the application context.
Based on your user name, I assume you opened this feature request: https://github.com/spring-projects/spring-amqp/issues/1365
Posting this here in case people come across this question.

Spring SessionRegistry provides empty session lists when #EnableJdbcHttpSession is used

Since I persisted the session information of resilient and load balanced spring-boot based microservices to PostgreSQL DB by adding #EnableJdbcHttpSession to our config, the SessionRegistry provides no information at all anymore (e.g. SessionRegistry::getAllPrincipals() empty list).
Also HttpSessionListener is not getting fired anymore.
Grateful for any hint
Frank

Getting Data from a Message Driven Bean into JSF Pages

I've got a message driven bean that receives JMS messages and I'd like to get some of that data into my JSF components (PrimeFaces) inside those web pages.
I understand getting data from a JSF web page through managed beans and into EJB's, but I'm going the other direction and not clear on this. Not clear on specifically, how to call and pass data to a managed bean for the displayed web page from an EJB.
My guess is this would look something like ...
(some event) ---> message driven bean ---> managed bean ---> JSF page
Of course the event into the MDB works fine, but only when this JSF web page is being displayed should the managed bean be accepting it's own events so they can be displayed on the web page.
Any help much appreciated.
i dont think you want the mdb to manipulate state of an mb.
i think what you want to do is have the mdb trigger a websockets push event that has the browser trigger a request.
look into primefaces push showcase and see if this is the func you are after
http://www.primefaces.org/showcase/push/facesmessage.jsf

jsf 2 session not replicating on cluster?

I read some question here some days ago that made me understand that a view scoped bean is on the session. Is this right?
I am asking because I have an jsf 2 + seam 3 + cdi app that on a single node works perfectly with the view scoped beans, and as soon as it is put on a cluster, I get one request working and the next is a view expired exception.
So, am I correct to assume that my session is not replicating correctly? On my web.xml I have the distributable tag. I am using jboss 6.1. Should I do anything else, on the app or jboss (apart from using the all context) to make it work?
Or I cannot use view scoped beans on a clustered environment?

Authenticated user and multiple requests (IIS7 MVC3)

This is one of those questions that maybe should go so serverfault, but then maybe there is a code-level solution.
Anyway, here is the question. I have a regular MVC3 application which requires user login to access (uses the Authorize tag on most of the actions). I also have a Silverlight object within the application that makes HTTP GET calls to a controller action which returns an image (in fact this is a map tile). This particular controller action has no authorize tag, and is therefore public.
The Silverlight component runs slow or just blocks, because the MVC application can apparently process only ONE request at a time, as confirmed by firebug. This means that the map tiles can be served only one after the other. Moreover, regular (non-map-related) requests are enqueued too, and everything times out after a while.
So to make a test, I setup another website with the same document root, and I instructed the Silverlight component to read tiles from there. Now tiles ARE requested concurrently and it runs smoothly.
So, is there any way to resolve this situation and use one site only?
If you are using Session on the server action that would explain why requests are queued. Because the Session is not thread safe ASP.NET serializes all requests from the same session and executes them sequentially.

Resources