// ----------------------------------------------------------------------------
protected void blast(T message) {
		logger.debug("blast called for message: " + message);
		Map<String,Object> filter = KStringUtil.toMap(message.getFilter());
		Long affinityAppId = null;
		Map<String, Object> data = createPayLoadData(message);
		List<D> deviceList = getDeviceList(filter, affinityAppId, message.isSandbox());
		int sendCount = 0;
		List<String> blastErrors = new ArrayList<String>();
		List<String> deviceIdList = new ArrayList<String>();
		for (D device : deviceList) {
			logger.debug("blast push device: " + device);
			KPushService.Platform platform = getPushService().getPushPlatform(device.getPlatformName(), device.isSandbox());
			String endpoint = device.getPushEndpoint();
			if (platform == null || endpoint == null) {
				continue;
			}
			try {
				getPushService().publish(platform, endpoint, message.getMessage(), data);
				logger.debug("\n--------------------------\n"
						+ "\npush message:"
						+ "\nplatform: " + platform
						+ "\nendpoint: " + endpoint
						+ "\nmessage: " + message
						+ "\ndata: " + data 
						+ "\n--------------------------\n"
				);
				sendCount += 1;
				deviceIdList.add(device.getId().toString());
			} catch (Exception e) {
				blastErrors.add(e.getMessage());
			}
		}
		logger.debug("blast: updating sendCount: " + sendCount); 
		if (blastErrors.size() > 0) {
			logger.warn("Broadcast blast errors" + KStringUtil.join(blastErrors, "\n\n"));
		}
		message.setDeviceCount(sendCount);
		// FIXME: this won't save since it's a blob type and underlying framework needs to support it
		message.setDevices(KStringUtil.join(deviceIdList,",").getBytes());
		update(message);
	}
protected void blast(T message) {
logger.debug("blast called for message: " + message);
Map<String,Object> filter = KStringUtil.toMap(message.getFilter());
Long affinityAppId = null;
Map<String, Object> data = createPayLoadData(message);
List<D> deviceList = getDeviceList(filter, affinityAppId, message.isSandbox());
int sendCount = 0;
List<String> blastErrors = new ArrayList<String>();
List<String> deviceIdList = new ArrayList<String>();
for (D device : deviceList) {
logger.debug("blast push device: " + device);
KPushService.Platform platform = getPushService().getPushPlatform(device.getPlatformName(), device.isSandbox());
String endpoint = device.getPushEndpoint();
if (platform == null || endpoint == null) {
continue;
}
try {
getPushService().publish(platform, endpoint, message.getMessage(), data);
logger.debug("\n--------------------------\n"
+ "\npush message:"
+ "\nplatform: " + platform
+ "\nendpoint: " + endpoint
+ "\nmessage: " + message
+ "\ndata: " + data
+ "\n--------------------------\n"
);
sendCount += 1;
deviceIdList.add(device.getId().toString());
} catch (Exception e) {
blastErrors.add(e.getMessage());
}
}
logger.debug("blast: updating sendCount: " + sendCount);
if (blastErrors.size() > 0) {
logger.warn("Broadcast blast errors" + KStringUtil.join(blastErrors, "\n\n"));
}
message.setDeviceCount(sendCount);
// FIXME: this won't save since it's a blob type and underlying framework needs to support it
message.setDevices(KStringUtil.join(deviceIdList,",").getBytes());
update(message);
}
protected void blast(T message) {
logger.debug("blast called for message: " + message);
Map<String,Object> filter = KStringUtil.toMap(message.getFilter());
Long affinityAppId = null;
Map<String, Object> data = createPayLoadData(message);
List<D> deviceList = getDeviceList(filter, affinityAppId, message.isSandbox());
int sendCount = 0;
List<String> blastErrors = new ArrayList<String>();
List<String> deviceIdList = new ArrayList<String>();
for (D device : deviceList) {
logger.debug("blast push device: " + device);
KPushService.Platform platform = getPushService().getPushPlatform(device.getPlatformName(), device.isSandbox());
String endpoint = device.getPushEndpoint();
if (platform == null || endpoint == null) {
continue;
}
try {
getPushService().publish(platform, endpoint, message.getMessage(), data);
logger.debug("\n--------------------------\n"
+ "\npush message:"
+ "\nplatform: " + platform
+ "\nendpoint: " + endpoint
+ "\nmessage: " + message
+ "\ndata: " + data
+ "\n--------------------------\n"
);
sendCount += 1;
deviceIdList.add(device.getId().toString());
} catch (Exception e) {
blastErrors.add(e.getMessage());
}
}
logger.debug("blast: updating sendCount: " + sendCount);
if (blastErrors.size() > 0) {
logger.warn("Broadcast blast errors" + KStringUtil.join(blastErrors, "\n\n"));
}
message.setDeviceCount(sendCount);
// FIXME: this won't save since it's a blob type and underlying framework needs to support it
message.setDevices(KStringUtil.join(deviceIdList,",").getBytes());
update(message);
}
protected void blast(T message) {
logger.debug("blast called for message: " + message);
Map<String,Object> filter = KStringUtil.toMap(message.getFilter());
Long affinityAppId = null;
Map<String, Object> data = createPayLoadData(message);
List<D> deviceList = getDeviceList(filter, affinityAppId, message.isSandbox());
int sendCount = 0;
List<String> blastErrors = new ArrayList<String>();
List<String> deviceIdList = new ArrayList<String>();
for (D device : deviceList) {
logger.debug("blast push device: " + device);
KPushService.Platform platform = getPushService().getPushPlatform(device.getPlatformName(), device.isSandbox());
String endpoint = device.getPushEndpoint();
if (platform == null || endpoint == null) {
continue;
}
try {
getPushService().publish(platform, endpoint, message.getMessage(), data);
logger.debug("\n--------------------------\n"
+ "\npush message:"
+ "\nplatform: " + platform
+ "\nendpoint: " + endpoint
+ "\nmessage: " + message
+ "\ndata: " + data
+ "\n--------------------------\n"
);
sendCount += 1;
deviceIdList.add(device.getId().toString());
} catch (Exception e) {
blastErrors.add(e.getMessage());
}
}
logger.debug("blast: updating sendCount: " + sendCount);
if (blastErrors.size() > 0) {
logger.warn("Broadcast blast errors" + KStringUtil.join(blastErrors, "\n\n"));
}
message.setDeviceCount(sendCount);
// FIXME: this won't save since it's a blob type and underlying framework needs to support it
message.setDevices(KStringUtil.join(deviceIdList,",").getBytes());
update(message);
}