Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

ramprasad madathil

Ranch Hand
+ Follow
since Jan 24, 2005
ramprasad likes ...
Eclipse IDE Tomcat Server Java
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
6
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by ramprasad madathil

>you can create an application context object and track the number of session and accordingly can restrict the access to the web site.

In a single server (not clustered) environment.

cheers.
8 years ago
> I have to change the TransactionType of DAO to Require_New?

I dont see what else you can do. Be reminded that a rollback of the outer transaction will not undo the commits made by the inner one. So you may have to manually compensate for the changes by the dao if the msg sending from within the mdb failed.

cheers.
So if all mdbs are the same, how do you determine which location the mdb should serve? As far as I can think, it should either be

1. You would either look up the location to serve from some apis your application has. In which case you really do not need the mdb to know through a property the location it has to serve.

2. or else you would read the location from the message property value (that you propose to use as a selector) again within your code using the message.getProperty() api. Which again makes the message selector redundant. You may as well do a branching logic using the property value inside the code.

Message selectors are used to serve different mdbs listening on the same queue for different messages. Since the messages are different, they would have different processing logic, are separate and different beans.Hence you push the job of message filtering (sending the right msg to the right mdb) to the provider rather than to the application. In your case, it does look like you can deploy the same mdb without message selectors and use the value of the property inside the mdb to determine further processing. That is unless there is something you have not told us

cheers,
ram.

I have several servers running the same code but each handling specific messages (they are spread by geographical area and must should treat all messages related to their area)

I thought to use a single queue and a message selector to filter the different message.



Just curious, how is it that the same code treats different messages the same?

As you rightly pointed, if you had the same queue for multiple messages, you would use message selectors so that the messages can be filtered for different mdbs to take different action. But reading through your post, there is only one mdb.

There is the UserTransaction.getStatus() method which will return a value of javax.transaction.Status.NoTransaction when there is no transaction associated with the current thread.

>should I create a member varible in mdb that all threads can share or use jndi to get seesion bean each time to make a logic call?

jndi to get session bean always.

cheers,
ram.

[javax.ejb.EJBException: Unable to complete container-managed transaction.; nested exception is: javax.transaction.SystemException]|#]



The stack trace does suggest that an underlying connection is closed before the container has had a chance to commit the transaction. In the absence of any other information, the most obvious thing to do would be to adjust the timeout property on the underlying connection. Did you try that?

cheers,
ram.

in this case, is the message still on Topic server ? (since MDB B has not done yet).



Yes if the message was a persistent one which in turn is a message property set by the sender.



If the answer to above question is yes, then when we restart the server for MDB A, will the message be re delivered to MDB A ? (note; MDB A has consumed it)


No, MDB A has consumed it

when we restart server for MDB B, will the message be re-delivered to MDB B ?


Yes, if MDB B is a Durable subscriber specified by the following property in it's ejb-jar.xml


cheers,
ram.
In a clustered environment, the issues arises when you try to store application wide data such as an active user list in an object on the jvm. Whenever the list is modified, you will have to find a way to propagate changes to the other servers on the cluster to keep the list 'in sync'.

If you are storing the list of active users in a db, that would solve the problem above.

Then the only issue that remains would be what I had posted earlier -
The user cannot of course log-in in the interval between when he closed the browser and the session expires on the server and you cannot do anything about it.

ram.
9 years ago

The solution above seems to be work, but some cases the logged user does not click on logout button! So, the session in this case will be expired, and if the user will try logon again will receive error. How can I handle this case?



The session would eventually expire on the server after the maximum inactive interval configured. Write a SessionListener and in the sessionDestroyed() method, remove the entry from wherever you are storing the list of active users.

The user cannot of course log-in in the interval between when he closed the browser and the session expires on the server and you cannot do anything about it.

It will also not work in a cluster though there are posts in this thread indicating it will.

cheers,
Ram.
9 years ago

have created a dynamic web program. when i am trying to access the same java program that web application its gving me MQJMS exception 2005 unable to create queue.



I am not sure if you have worded it wrong, but it's unlikely that you are creating a queue. Queues are administered objects usually and are configured outside the client code as a server administrative task.

Does the exact same code of your standalone client not work from within your web app? Is it possible to post the code?

cheers,
ram.





The other option is to use the receive() method of the QueueReceiver in place of the MessageListener.

So your code would go something like below (pseudo-code)

for(;;){
Message m = queueReceiver.receive();
//processMessage();
Thread.sleep(timeInterval); //now pause
}

cheers,
ram.
javax.jms.Connection.stop() temporarily stops a connection's delivery of incoming messages.

ram.
As I mentioned in my previous post, it does not form part of the JMS api. You will have to look at the documentation for the JMS provider you use.
In weblogic for example, you can set it programmatically



Here is the javadoc for weblogic.

cheers,
ram.
You can set a delay in delivery on the queue. It is non-standard but most JMS vendors support it. Will that do?

ram.