# A question about fuction "getRequestKey" in opcua program

**URL:** <https://forum.inductiveautomation.com/t/a-question-about-fuction-getrequestkey-in-opcua-program/3754>\
**Category:** Module Development\
**Created:** [December 15, 2011, 8:24am UTC](https://forum.inductiveautomation.com/t/a-question-about-fuction-getrequestkey-in-opcua-program/3754 "2011-12-15T08:24:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![wengzijue](https://avatars.discourse-cdn.com/v4/letter/w/ee59a6/32.png) [@wengzijue](https://forum.inductiveautomation.com/u/wengzijue)\
**Post date:** [December 15, 2011, 8:24am UTC](https://forum.inductiveautomation.com/t/a-question-about-fuction-getrequestkey-in-opcua-program/3754/1 "2011-12-15T08:24:48Z")

</div>

Can you give me more detailed information about fuction “getRequestKey(byte[] message)” ,It seems only get the key of received message ,not sended message.  
please tell me more about the “key”,thanks.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 15, 2011, 4:29pm UTC](https://forum.inductiveautomation.com/t/a-question-about-fuction-getrequestkey-in-opcua-program/3754/2 "2011-12-15T16:29:37Z")

</div>

```auto
	/**
	 * <p>
	 * Extract the request key from the given message. This key is used to identify the
	 * {@link Request} that this message is a response to.
	 * </p>
	 * 
	 * @param message
	 * The message to extract a key from.
	 * 
	 * @return A key for this message.
	 */
	protected abstract Object getRequestKey(M message);
```

The key is something that you use to link an incoming response to a request that is waiting for a response. In most cases you might think this is a non-issue, since with simpler protocols like Modbus there’s only ever 1 request at a time, but the driver framework allows for many.

The key is usually something that can be extracted from the delivered bytes of a response. Modbus, for example, has a sequence number in the MBAP header that is used as the key. The sequence is incremented when a request is sent, and then that sequence number is extracted (by you, in getRequestKey()) when a response is received. The driver framework then grabs the Request object it’s holding on to with that key (Request#getKey() is called after Request#sendMessage()) and delivers the response to it (Request#receiveMessage(M message, Object key)).

---

<div class="post-metadata">

**Author:** ![wengzijue](https://avatars.discourse-cdn.com/v4/letter/w/ee59a6/32.png) [@wengzijue](https://forum.inductiveautomation.com/u/wengzijue)\
**Post date:** [December 16, 2011, 8:01am UTC](https://forum.inductiveautomation.com/t/a-question-about-fuction-getrequestkey-in-opcua-program/3754/3 "2011-12-16T08:01:19Z")

</div>

Thanks

---

<div class="post-metadata">

**Author:** ![wengzijue](https://avatars.discourse-cdn.com/v4/letter/w/ee59a6/32.png) [@wengzijue](https://forum.inductiveautomation.com/u/wengzijue)\
**Post date:** [December 16, 2011, 9:05am UTC](https://forum.inductiveautomation.com/t/a-question-about-fuction-getrequestkey-in-opcua-program/3754/4 "2011-12-16T09:05:10Z")

</div>

please give me more material about UA programing such as javadoc for all protected methods to [wengzijue@yahoo.com.cn](mailto:wengzijue@yahoo.com.cn) if possible and if it is convenient for you

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 16, 2011, 4:37pm UTC](https://forum.inductiveautomation.com/t/a-question-about-fuction-getrequestkey-in-opcua-program/3754/5 "2011-12-16T16:37:52Z")

</div>

The 7.3.3-beta2 ModuleSDK, available [here](http://inductiveautomation.com/downloads/ignition/development), should have JavaDocs with protected methods included.
