// server is not accessible
throw new XmlBlasterException(glob, ErrorCode.RESOURCE_TEMPORARY_UNAVAILABLE, ME,
"The Subscription for '" + getDispatchManager().getSessionName().toString() + "' failed since the server is currently not available");
}
MsgQueueSubscribeEntry entry = (MsgQueueSubscribeEntry)msgQueueEntry;
if (!entry.getSubscribeQosData().hasSubscriptionId()) {
entry.getSubscribeQosData().generateSubscriptionId(glob.getXmlBlasterAccess().getSessionName(), entry.getSubscribeKeyData());
//String subscriptionId = QueryKeyData.generateSubscriptionId(dispatchManager.getQueue().getStorageId().getPostfix());
//entry.getSubscribeQosData().setSubscriptionId(subscriptionId);
}
statRetQos.setSubscriptionId(entry.getSubscribeQosData().getSubscriptionId());
SubscribeReturnQos subscribeReturnQos = new SubscribeReturnQos(glob, statRetQos, true);
entry.setReturnObj(subscribeReturnQos);
}
else if (MethodName.UNSUBSCRIBE == msgQueueEntry.getMethodName()) {
MsgQueueUnSubscribeEntry entry = (MsgQueueUnSubscribeEntry)msgQueueEntry;
String id = entry.getUnSubscribeKey().getOid();
if (id != null && id.startsWith(Constants.SUBSCRIPTIONID_PREFIX)) {
statRetQos.setSubscriptionId(id);
UnSubscribeReturnQos[] unSubscribeReturnQosArr = new UnSubscribeReturnQos[] { new UnSubscribeReturnQos(glob, statRetQos) };
entry.setReturnObj(unSubscribeReturnQosArr);
}
else {
throw new XmlBlasterException(glob, ErrorCode.USER_CONFIGURATION, ME,
"UnSubscribe on oid='" + id + "' is not possible in offline/polling mode without an exact subscription ID given. " +
"See 'http://www.xmlBlaster.org/xmlBlaster/doc/requirements/client.failsafe.html' for more details.");
}
}
else if (MethodName.ERASE == msgQueueEntry.getMethodName()) {
MsgQueueEraseEntry entry = (MsgQueueEraseEntry)msgQueueEntry;
if (entry.getEraseKey().isExact()) {
statRetQos.setKeyOid(entry.getEraseKey().getOid());
EraseReturnQos[] eraseReturnQosArr = new EraseReturnQos[] { new EraseReturnQos(glob, statRetQos) };
entry.setReturnObj(eraseReturnQosArr);
}
else {
throw new XmlBlasterException(glob, ErrorCode.USER_CONFIGURATION, ME,
"Erase on oid='" + entry.getEraseKey().getOid() + "' is not possible in offline/polling mode without an exact topic oid given. " +
"See 'http://www.xmlBlaster.org/xmlBlaster/doc/requirements/client.failsafe.html' for more details.");
}
}
else if (MethodName.CONNECT == msgQueueEntry.getMethodName()) {
ConnectReturnQos connectReturnQos = new ConnectReturnQos(glob, ((MsgQueueConnectEntry)msgQueueEntry).getConnectQosData());
if (!connectReturnQos.getSessionName().isPubSessionIdUser()) {
throw new XmlBlasterException(glob, ErrorCode.USER_CONFIGURATION, ME,
"Can't find an xmlBlaster server. Try to provide the server host/port as described in " +
"http://www.xmlblaster.org/xmlBlaster/doc/requirements/client.configuration.html " +
"or provide a public session ID to support polling for xmlBlaster without an initial connection. " +
"See 'http://www.xmlBlaster.org/xmlBlaster/doc/requirements/client.failsafe.html' for more details.");
}
msgQueueEntry.setReturnObj(connectReturnQos);
}
else if (MethodName.DISCONNECT == msgQueueEntry.getMethodName()) {
if (log.isLoggable(Level.FINE)) log.fine("disconnect returns void, nothing to do");
}
else if (MethodName.GET == msgQueueEntry.getMethodName()) {
MsgQueueGetEntry entry = (MsgQueueGetEntry)msgQueueEntry;
throw new XmlBlasterException(glob, ErrorCode.USER_CONFIGURATION, ME,
"Synchronous GET on oid='" + entry.getGetKey().getOid() + "' is not possible in offline/polling mode. " +
"See 'http://www.xmlBlaster.org/xmlBlaster/doc/requirements/client.failsafe.html' for more details.");
}
else {
log.severe("Internal problem, MsgQueueEntry '" + msgQueueEntry.getEmbeddedType() + "' not expected here");