Forwarded attribute in Java

Dear Experts,

Need some help in creating forwarded attribute in Java. I've specified the rootAttribute Property for the attribute but still the value of the root attribute is not getting reflected.

Below is the code snippet:

@Attribute(name="FwdAttr")
@AttributeProperties(rootAttribute="tango://lmc:10000/test/dev/1/RootAttr")
private float[] fwdAttr = new float[3];

public org.tango.server.attribute.AttributeValue getFwdAttr() throws DevFailed {

org.tango.server.attribute.AttributeValue attributeValue = new org.tango.server.attribute.AttributeValue();

attributeValue.setValue(fwdAttr);

return attributeValue;
}

If getFwdAttr() method is commented, INIT_ERROR is thrown.

However, I'm able to create Forwarded attributes dynamically using

dynamicManager.addAttribute(new ForwardedAttribute(…))

Is the dynamic creation only supported mechanism to create Forwarded Attributes in Java?

In the section 7.8.1 of the TANGO Control Manual 9.1, it is stated that "If you subscribe to event(s) on a forwarded attribute, the subscription is forwarded to the root attribute. When the event is received by the forwarded attribute, the attribute name in the event data is modified to reflect the forwarded attribute name and the event is pushed to the original client(s)."

I want to log a message when an event raised by the root attribute is received by the forwarded attribute, i.e I want to log a message before the modification of attribute name in the event data at the device server exposing forwarded attribute. Please provide your thoughts on this.

Vatsal Trivedi
Hi Vatsal

A forwarded attribute is between a root attribute (root device) and a client through an intermediate device.
The attribute value is available for a client not for the intermediate device.
Regards
Pascal
Hi Pascal,

Thanks for the response. Let me explain you the task I want to perform.

Suppose there is a TANGO Device "A" containing a root attribute named "AttrA". There is a TANGO Device "B" containing a forwarded attribute named "AttrB". "AttrA" attribute of the TANGO Device A is the root attribute for the "AttrB" attribute of the TANGO Device B. A TANGO Client has subscribed to an event on "AttrB" attribute (i.e forwarded attribute) of the TANGO Device B. This subscription is forwarded to the "AttrA" attribute (i.e root attribute) of the TANGO Device A.

When an event is generated for the "AttrA" attribute (i.e root attribute) of the TANGO Device A, it is first received at the TANGO Device B. Suppose TANGO Device B receives the event at time t1. Now the attribute name in the event data is modified to reflect the forwarded attribute (i.e AttrB) and is sent to the client. Suppose the client receives the event at time t2. I want to calculate the difference between t2 and t1.

In short, I want to calculate the latency between the time at which intermediate device receives the TANGO event and the time at which a TANGO client receives the event. Is it possible to calculate this?

I am able to calculate the latency between the time at which the event is generated from the root device and the time at which a TANGO client receives the event.

Apologies for explaining the scenario in too much detail.

Vatsal Trivedi
Hi
To calculate the latency, it is possible only if you manage attribute and events by yourself.
The idea of the forwarded attribute is, precisely, to be transparent for device B.
Pascal
Dear Team,

Was working with forward attribute in Java.
Wanted to know can we have it across Tango Facility.

Example: Attribute "A" on Tango Facility say T1
Attribute "B" on Tango Facility say T2.

In this case if "A" is root attribute & "B" is forwarded attribute, does this work, or forward attribute are meant only for same Tango Facility?

Note: I am trying this scenario currently but no luck.
I can reproduce the error if required.
Regards,
TCS_GMRT
Yes you can use forward attributes across different Tango facilities if both of them can be reached via TCP/IP routing.
You should declare the root attribute with the following syntax:
let's say the facility where the root attribute is located is TANGO_HOST=T1:10000
tango://t1:10000/aa/bb/cc/root_att_name
Cheers
Jean-Michel
Thanks Jean for the prompt reply ….

I tried but seems there is a gap in understanding. Can you please help.

Extrapolating the above scenario:

Example:
Attribute "A" on Tango Facility say T1
Attribute "B" on Tango Facility say T2.
In this case if "A" is root attribute & "B" is forwarded attribute.

In Jive for device with attribute "A" (root attribute):
I have added a property __root_att = tango://<T1_HOSTNAME>:10000/<domain>/<family>/<member>/root_att_name

In Java Device Server which contains the forwarded attribute:

private void addForwardedAttributes() throws DevFailed {
		xlogger.entry();
		//	Don't forget to set attribute __root_att properties
		dynamicManager.addAttribute(new ForwardedAttribute("tango://<T1_HOSTNAME>:10000/<domain>/<family>/<member>/root_att_name", "motor_speed", "motor_speed_label"));
		
		xlogger.exit();
	}

Where am I going wrong ?

Regards,
TCS_GMRT
Regards,
TCS_GMRT
Hi

You write : "A" is root attribute & "B"
Then you write: In Jive for device with attribute "A" (root attribute):
I have added a property __root_att


But if A is root of B, this property must be set for attribute on B device.

Pascal
Dear Pascal,

Thanks for the valuable inputs. That indeed helped us.
The problem why it was not working was we did not had hosts added in "/etc/hosts". Once we did that it started working.
Regards,
TCS_GMRT
Edited 7 years ago
Dear Team,

How to create a forwarded attribute in Java Client?
My root attribute in present in Device Server.
Regards,
TCS_GMRT
 
Register or login to create to post a reply.