public StanzaReceiverQueue addReceiver(Entity entity, String resourceId) {
if (!(getServerRuntimeContext().getStanzaRelay() instanceof StanzaReceiverRelay)) {
throw new RuntimeException("cannot add receiver - the stanza relay is of a different kind");
}
StanzaReceiverQueue relay = new StanzaReceiverQueue();
if (resourceId != null)
entity = new EntityImpl(entity.getNode(), entity.getDomain(), resourceId);
((StanzaReceiverRelay) getServerRuntimeContext().getStanzaRelay()).add(entity, relay);
return relay;
}