We are trying to retrieve all elements hosted on the same DMA as the one where our script is running.
Currently, we use the following approach with the core DMS class library:
dms.GetElements().Where(e => e.Host == thisAgent);
We are considering replacing this with:
dms.GetAgent(thisDma).GetElements();
Internally, this method sends the following SLNet message:
GetInfoMessage message = new GetInfoMessage
{
Type = InfoType.ElementInfo,
DataMinerID = this.Id,
};
Question:
Does GetAgent(id).GetElements() also return elements that were originally created on a different DMA but later migrated to the current DMA? Or does it only return elements whose originating DMA matches?
Hi Tom,
GetInfoMessage(InfoType.Elements) will always return all elements, regardless of what the DataMinerID property says. The DataMinerID property is being used to route the request to a specific agent in the cluster.
You’re looking for GetInfoMessage(InfoType.LocalElementInfo), which will return the elements hosted on the agent the request was sent to (possibly rerouted via the DataMinerID property). The result will include all elements currently hosted on that DMA, including elements that were swarmed/migrated over there or were imported there.
Hi Tom,
Not familiar with the core DMS class library implementation but the raw GetInfoMessage for ElementInfo will always return all elements in the DMS, regardless of who hosts what.
DataMinerId here will only be used for routing, it refers to which agent will answer the request.