Behavior of Change Event in Tango

Hello Team,

I am exploring Tango events and observed a strange behaviour for "Change Event".

I have created java based Tango server and a client. The String attribute on which I have configured the change event is "TestStringA". In the server code, I have a command named "TestCommand" in which I am changing the String attribute value, and later pushing the event with the help of deviceManager which is subscribed by the client. Further, I have also created a user defined Callback class in which I am overriding the push_event method. (Asynchronous Model)

Below are different cases on which I have observed different results.

Case: 1
———

Modify string Attribute properties as "checkChangeEvent = true" and "pushChangeEvent = true"
In this case, the string attribute value is changed but the change event is not observed at client end.

Case: 2
———

Modify string Attribute properties as "checkChangeEvent = false" and "pushChangeEvent = true"
In this case, the string attribute value is changed and the change event is observed at client end.

As per my understanding, the property "checkChangeEvent" is used to track the change occured on the attribute. In both the cases, change occured on the attribute but the change event is not observed for Case: 1.

I am attaching the sample code here with this post. Any help to clear my understanding will be appreciated.

Kind regards,
Jyotin
—————–

Nothing comes to you, it comes for you! - Joel Osteen
Hi!

This reminds me a problem I observed a few months ago with the Java servers.
I saw some cases where the first or sometimes the second change event was not sent to the clients.
I observed this on numerical attributes. I must say I didn't remember trying with the string attributes at that time.
This problem should be fixed for the numerical attributes now in the latest version.
To see if it's coming from a similar problem, you could try to modify your code in order to set the string attribute to a different value every time TestCommand is called. Then by executing TestCommand several times, you might see events coming at some point with checkChangeEvent = true, maybe not the first time you execute it, but maybe the second time?
Could you please tell us what version of the Tango jar files are you using?

Kind regards

Reynald
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
Hello Reynald,

Thank you for the response.


Reynald
To see if it's coming from a similar problem, you could try to modify your code in order to set the string attribute to a different value every time TestCommand is called. Then by executing TestCommand several times, you might see events coming at some point with checkChangeEvent = true, maybe not the first time you execute it, but maybe the second time?

Yes, I have tried your suggestion and can see the events at client when checkChangeEvent = true. But, observed that the first event is always missed in the case(checkChangeEvent = true).

Reynald
Could you please tell us what version of the Tango jar files are you using?

I am currently using JTango-9.0.3 jar files.

Once again, thanks Reynald for your help. Hope this will get fixed in the next version.

Kind regards,
Jyotin

————
Edited 9 years ago
Hi Jyotin,

I've done some tests with the latest JTango jar file that we got and the problem seems to be still present.
I've posted a message on the Sourceforge bug tracking system on the ticket I created about a similar problem a while ago.

You can follow this issue here:
https://sourceforge.net/p/tango-cs/bugs/708

Hoping this helps

Reynald
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
Hello Reynald,

Thank you for updating it on bug tracking system.

Sourceforge bug tracking system updated that the problem is fixed in the latest JTango-9.0.5 jar files. I have tested using those jar files with the above provided code and it works if the TestStringA attribute value is set to a different value every time TestCommand is executed. (I am setting the TestStringA in TestCommand as:

setTestStringA("Att: "+ testDoubleA);
deviceManager.pushEvent("TestStringA", new AttributeValue(getTestStringA()), EventType.CHANGE_EVENT);
where, TestDoubleA is the double attribute which is incremented every time the command is executed.)

With the above changes, the events are observed properly at client.

Now, I have a test case where it seems the problem is still present. In this test case, first the TestSringA value is set to Initialized! and after the command execution, the value get changed to Executed. So we will observe first event as the string attribute value will get changed from Initialized to Executed. Once the string value is changed to Executed, we again change the value to any random string from Jive (Atk Panel - Monitor Device). Ideally, if we execute the Test command, the event should appear as that random string will be changed again to Executed, but it is not the case. The events are not appearing at client.

Kind regards,
Jyotin
Hi Jyotin,

Glad to know that the latest version seems to fix some problems. smile
Can you please post the code demonstrating the problems you are still seeing?
Thanks in advance.

Reynald
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
Reynald
Can you please post the code demonstrating the problems you are still seeing?
Thanks in advance.

Reynald

Hello Reynald,

There is no changes made in the code. The code is the same that has been attached earlier. Let me brief you with the problem:

Note: I am using the latest JTango-9.0.5 jar files.

1. Run the TestServer2 java class. –> TestStringA attribute is set to "Initialized!"
2. Run the TestClient2 java class.
3. Executed the TestCommand from TestClient2. —> TestStringA attribute is changed to "Executed"
4. First event is observed at client on the above change.
5. Now, from Jive(ATK Panel) we change the TestStringA from "Executed" to let's say "xyz123"
6. Executed the TestCommand from TestClient2. —> TestStringA attribute is changed to "Executed" from "xyz123".
7. But, the event for this change is not observed at client end.

Hope this helps to understand the problem.

Jyotin
Edited 9 years ago
Hi Jyotin,

The behaviour you are observing is the expected one.
In your code, the PushEvent() method is executed only when TestCommand is executed.
If you set "checkChangeEvent = true", the Tango library will check that the new value is different than the value which was sent with the last sent event.
Since PushEvent() is called only in the TestCommand command in your case, the first time you execute it, the event is sent (since it is the first event) with the value "Executed".
When you change the TestStringA attribute with AtkPanel, you don't execute pushEvent(). So the attribute value is changed, but the clients will not be aware there was a change.

The second time you execute TestCommand, the attribute is set again to "Executed".
Since this is the same value as the last event which was sent, no event is sent when pushEvent() is executed.

This is the expected behaviour.

Hoping this helps to understand better.

Reynald
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
Hello Reynald,

Thank you for the detailed explanation.
It cleared all my doubts for this issue.

Cheers! smile

Jyotin
 
Register or login to create to post a reply.