throw new IllegalStateException(ME + ".receive: you have set a messageListener for this session so synchronous message consumption is currently not allowed");
try {
this.session.setSyncMode(XBSession.MODE_SYNC); // to disallow invocation of updates
// query with a given GetQos ...
// TODO cache the queryKey here
GetQos getQos = new GetQos(this.global);
QuerySpecQos querySpecQos = new QuerySpecQos(this.global, "QueueQuery", "1.0", "maxEntries=1&maxSize=-1&consumable=true&waitingDelay=" + delay + "&subscriptionId=" + this.subscribeReturnQos.getSubscriptionId());
getQos.addQuerySpec(querySpecQos);
String getOid = "__cmd:" + this.session.sessionName + "/?callbackQueueEntries";
MsgUnit[] mu = this.global.getXmlBlasterAccess().get(new GetKey(this.global, getOid), getQos);
if (mu == null || mu.length < 1 || mu[0] == null) return null;
String sender = mu[0].getQosData().getSender().getAbsoluteName();
return MessageHelper.convertFromMsgUnit(this.session, sender, mu[0]);