/*
Remote queue point (queue or link) specific warning message
(510343)
973663
protected void issueDepthIntervalMessage(long depth)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "issueDepthIntervalMessage", new Long(depth));
    
    if(destinationHandler.isLink())
    {
      // {0} messages queued for transmission from messaging engine {1} to foreign bus {2} on link {3}.
      SibTr.info(tc, "REMOTE_LINK_DESTINATION_DEPTH_INTERVAL_REACHED_CWSIP0789",
          new Object[] {new Long(depth),
                        destinationHandler.getMessageProcessor().getMessagingEngineName(),
                        ((LinkHandler)destinationHandler).getBusName(),
                        destinationHandler.getName()});
    }
    else
    {
      // {0} messages queued for transmission on messaging engine {1} to destination {2} on messaging engine {3}.
      SibTr.info(tc, "REMOTE_DESTINATION_DEPTH_INTERVAL_REACHED_CWSIP0788",
          new Object[] {new Long(depth),
          destinationHandler.getMessageProcessor().getMessagingEngineName(),
                        destinationHandler.getName(),
                        SIMPUtils.getMENameFromUuid(((PtoPOutputHandler)getOutputHandler()).getTargetMEUuid().toString())});
    }
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "issueDepthIntervalMessage");
  }
279764
function getQueuedLink(callback, seconds) {
  var dateField = 'queued.lastAttempt';
  seconds = seconds || DELAY_SECONDS;
  // function to process the link
  var process = function(err, res) {
    var queuedLink = null;
    if (res && res.hits && res.hits.hits.length) {
      var hit = res.hits.hits[0]._source;
      var queued = hit.queued;
      queuedLink = { uri: hit.uri, queued: queued, total: res.hits.total };
      queued.lastAttempt = new Date().toISOString();
      queued.attempts = queued.attempts + 1;
      hit.queued = queued;

      // update accesses
      contentLib.indexContentItem(hit, {state: 'queued', member: queued.member}, function(err, res) {
        // process the link
        if (!err) {
          callback(null, queuedLink);
        } else {
          utils.passingError(err);
        }
      });
    } else {
      callback(err, null);
    }
  };

 // call query with the function
  GLOBAL.svc.indexer.formQuery({query: {
    terms: dateField + ':<now-' + seconds + 's AND state:queued AND queued.attempts:<' + MAX_ATTEMPTS
  }, sort: dateField, sourceFields : ['uri', 'title', 'queued.*'], size : 1 }, process);
}
718627
public RemoteReceiveQueue createRemoteReceiveQueue(String strQueueName, String strQueueType) throws RemoteException
    {
        MessageManager messageManager = this.getEnvironment().getMessageManager(this.getApplication(), true);
        BaseMessageReceiver receiver = (BaseMessageReceiver)messageManager.getMessageQueue(strQueueName, strQueueType).getMessageReceiver();
        ReceiveQueueSession remoteQueue = new ReceiveQueueSession(this, receiver);
        return remoteQueue;
    }
1105717
public void removeXmitQueuePoint(SIBUuid8 meUuid)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "removeXmitQueuePoint", meUuid);

    if (_xmitQueuePoints != null)
    {
      synchronized(_xmitQueuePoints)
      {
        _xmitQueuePoints.remove(meUuid);
      }
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "removeXmitQueuePoint");
  }
44520
@Override
  public void onNext(final RemoteEvent<T> value) {
    try {

      LOG.log(Level.FINEST, "Link: {0} event: {1}", new Object[] {linkRef, value});

      if (linkRef.get() == null) {
        queue.add(value);

        final Link<byte[]> link = transport.get(value.remoteAddress());
        if (link != null) {
          LOG.log(Level.FINEST, "transport get link: {0}", link);
          setLink(link);
          return;
        }

        final ConnectFutureTask<Link<byte[]>> cf = new ConnectFutureTask<>(
            new ConnectCallable(transport, value.localAddress(), value.remoteAddress()),
            new ConnectEventHandler<>(this));
        executor.submit(cf);

      } else {
        // encode and write bytes
        // consumeQueue();
        LOG.log(Level.FINEST, "Send: {0} event: {1}", new Object[] {linkRef, value});
        linkRef.get().write(encoder.encode(value));
      }

    } catch (final RemoteRuntimeException ex) {
      LOG.log(Level.SEVERE, "Remote Exception", ex);
      throw ex;
    }
  }
1371677
protected void remoteInit() throws JMSException
    {
        QueueBrowserGetEnumerationQuery query = new QueueBrowserGetEnumerationQuery();
        query.setSessionId(session.getId());
        query.setBrowserId(browser.getId());
        QueueBrowserGetEnumerationResponse response = (QueueBrowserGetEnumerationResponse)transportEndpoint.blockingRequest(query);
        this.id = response.getEnumId();
        log.debug("Remote queue browser enumeration ID is "+id);
    }
1060406
function (server, type, para, onDone) {
	
	var url = server + 'event/' + type;
	LOG.warn('remoteEvent url: ' + url, 'Entry');
	UTIL.HTTPpost(url, para, function(err, res, resObj) {
		if (err) {
			// get port fail, try to trace
			LOG.stack();
			UTIL.safeCall(onDone);
			return;
		}
		
		UTIL.safeCall(onDone, resObj[SR.Tags.UPDATE], resObj[SR.Tags.PARA]);
	});
}
1281911
def get_queue_url(queue_name):
    """"""
    client = boto3.client("sqs", CURRENT_REGION)
    queue = client.get_queue_url(QueueName=queue_name)

    return queue["QueueUrl"]
812178
function(err, res) {
    var queuedLink = null;
    if (res && res.hits && res.hits.hits.length) {
      var hit = res.hits.hits[0]._source;
      var queued = hit.queued;
      queuedLink = { uri: hit.uri, queued: queued, total: res.hits.total };
      queued.lastAttempt = new Date().toISOString();
      queued.attempts = queued.attempts + 1;
      hit.queued = queued;

      // update accesses
      contentLib.indexContentItem(hit, {state: 'queued', member: queued.member}, function(err, res) {
        // process the link
        if (!err) {
          callback(null, queuedLink);
        } else {
          utils.passingError(err);
        }
      });
    } else {
      callback(err, null);
    }
  }
1161814
def queue_pull(object_class, remote_id)
      queue_item = QueueItem.new( :kind => "pull",
                                  :object_type => object_class.name,
                                  :object_remote_id => remote_id,
                                  :state => "new" )
      queue_item.save
    end
1197491
@Override
    public OutputHandler getLocalPostMedPtoPOH(boolean localMessage,
                                               boolean forcePut,
                                               boolean singleServer)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc,
                        "getLocalPostMedPtoPOH",
                        new Object[] { Boolean.valueOf(localMessage),
                                      Boolean.valueOf(forcePut),
                                      Boolean.valueOf(singleServer),
                                      this });

        OutputHandler result = null;

        //check that the localisation is not full or send inhibited
        boolean isSendAllowed = true;
        boolean isAtQueueHighLimit = false;

        //Only check elsewhere in an ND environment.  In a single server
        //environment, the message must be put locally
        if (!singleServer)
        {
            try
            {
                //send allowed can only be false if forcePut is false
                isSendAllowed =
                                forcePut || _pToPLocalMsgsItemStream.isSendAllowed();

                //Only check queue high limit if the message was put locally
                //and if forcePut is false
                if (!forcePut && localMessage)
                {
                    isAtQueueHighLimit = _pToPLocalMsgsItemStream.isQHighLimit();
                }
            } catch (Exception e)
            {
                //No FFDC code needed
                isSendAllowed = true;
                isAtQueueHighLimit = false;
            }
        }

        if (isSendAllowed && !isAtQueueHighLimit)
        {
            result =
                            _localisationManager.
                                            getQueuePointOutputHandler(_messageProcessor.getMessagingEngineUuid());
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "getLocalPostMedPtoPOH", result);

        return result;
    }
1034189
private void checkLink(LinkQueueItem queueItem)
    {
        int responseCode = this.httpChecker.check(queueItem.getLinkReference());

        Map<String, LinkState> contentReferences =
            this.linkStateManager.getLinkStates().get(queueItem.getLinkReference());
        if (contentReferences == null) {
            contentReferences = new ConcurrentHashMap<>();
        }
        LinkState state = new LinkState(responseCode, System.currentTimeMillis(), queueItem.getContextData());
        contentReferences.put(queueItem.getContentReference(), state);
        this.linkStateManager.getLinkStates().put(queueItem.getLinkReference(), contentReferences);

        // If there's an error, then send an Observation Event so that anyone interested can listen to it.
        if (responseCode < 200 || responseCode > 299) {
            Map<String, Object> eventData = new HashMap<>();
            eventData.put(EVENT_DATA_URL, queueItem.getLinkReference());
            eventData.put(EVENT_DATA_SOURCE, queueItem.getContentReference());
            eventData.put(EVENT_DATA_STATE, state);
            eventData.put(EVENT_DATA_CONTEXTDATA, queueItem.getContextData());
            sendEvent(queueItem.getLinkReference(), eventData);
        }
    }
540215
public void init(RemoteTask server, BaseMessageQueue baseMessageQueue)
        throws RemoteException
    {
        super.init(baseMessageQueue);
        m_sendQueue = server.createRemoteSendQueue(baseMessageQueue.getQueueName(), baseMessageQueue.getQueueType());
    }
607123
public void queue(JFapByteBuffer bufferData,
                     int segmentType,
                     int requestNumber,
                     int priority,
                     SendListener sendListener,
                     Conversation conversation,
                     Connection connection,
                     int conversationId,
                     boolean pooledBuffers,
                     boolean partOfExchange,
                     long size,
                     boolean terminal,
                     ThrottlingPolicy throttlingPolicy)
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "queue");
      TransmissionDataIterator iterator =
         TransmissionDataIterator.allocateFromPool(connection,
                                                   bufferData,
                                                   priority,
                                                   pooledBuffers,
                                                   partOfExchange,
                                                   segmentType,
                                                   conversationId,
                                                   requestNumber,
                                                   conversation,
                                                   sendListener,
                                                   terminal,
                                                   (int)size);

      // begin F193735.3
      if (type == Conversation.ME)           meQueuedBytes += size;
      else if (type == Conversation.CLIENT)  clientQueuedBytes += size;
      // end F193735.3

      queueInternal(iterator, throttlingPolicy, terminal);

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "queue");
   }
370397
@Override
    public LocalizationPoint getQueuePoint(SIBUuid8 meUuid)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "getQueuePoint", new Object[] { meUuid, this });

        PtoPMessageItemStream stream = null;

        if (meUuid.equals(_messageProcessor.getMessagingEngineUuid()))
        {
            stream = _pToPLocalMsgsItemStream;
        }
        else
        {
            stream = _localisationManager.getXmitQueuePoint(meUuid);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "getQueuePoint", stream);

        return stream;
    }
603905
function(queueName, target, method) {
    var queues = this._queues, queue;
    if (!queues) { queues = this._queues = {}; }
    queue = queues[queueName];
    if (!queue) { queue = queues[queueName] = []; }

    var args = arguments.length > 3 ? slice.call(arguments, 3) : null;
    queue.push({ target: target, method: method, args: args });
    return this;
  }
50870
function makeRemote(id) {
        var remotePromise = Q.makePromise({
            when: function () {
                return this;
            }
        }, function (op, args) {
            var localId = makeId();
            var response = makeLocal(localId);
            _debug("sending:", "R" + JSON.stringify(id), JSON.stringify(op), JSON.stringify(encode(args)));
            connection.put(JSON.stringify({
                "type": "send",
                "to": id,
                "from": localId,
                "op": op,
                "args": encode(args)
            }));
            return response;
        });
        remotes.set(r,id);
        return remotePromise;
    }