-/*
-Retreives the transaction table entry for the given request.
-Returns error in case the transaction cannot be found.
-*/
-func (t *Tracker) Retrive_transaction(subID uint16, act Action) (*Transaction, error){
- key := Transaction_key{subID, act}
- if xact, ok := t.transaction_table[key]; ok {
- return xact, nil
+func (t *Tracker) TrackTransaction(endpoint RmrEndpoint, params *RMRParams, respReceived bool, forwardRespToXapp bool) (*Transaction, error) {
+
+ trans := &Transaction{
+ tracker: nil,
+ Subs: nil,
+ RmrEndpoint: endpoint,
+ Mtype: params.Mtype,
+ Xid: params.Xid,
+ OrigParams: params,
+ RespReceived: respReceived,
+ ForwardRespToXapp: forwardRespToXapp,
+ }
+
+ t.mutex.Lock()
+ defer t.mutex.Unlock()
+
+ xappkey := TransactionXappKey{endpoint, params.Xid}
+ if _, ok := t.transactionXappTable[xappkey]; ok {
+ err := fmt.Errorf("Tracker: Similar transaction with xappkey %s is ongoing, transaction %s not created ", xappkey, trans)
+ return nil, err