请问添加标签后多久后才能发送消息,多久后才能移除这个标签

标签: #<Tag:0x00007f6584e94080>

你好,目前需要给多种类型的用户进行推送,我们通过查询用户的registration_id注册了某个标签,然后通过标签并集进行推送,推送完毕后移除该标签.目前发现有些客户能收到消息,有些客户收不到消息,初步怀疑是推送消息之后立刻移除消息导致的,然后设定5分钟后再移除标签,但是发现还是收不到,怀疑是否是标签还没有设置成功消息就已经推送了导致部分用户没有收到消息,

1.想问一下,是否有这个可能呢,或者是什么原因导致的.
2.另外,我可以指定registration_id并且这些registration_id必须存在某些标签的用户进行推送吗?

1、标签设置成功之后(回调成功),则发消息必然收的到,在发完消息(消息返回成功),再移除 标签,不影响这条消息的接收

收不到的就代表你发消息的时候他没设置标签成功

2、使用交集
registrationID和tag同时存在即为交集
https://docs.jiguang.cn/jpush/server/push/rest_api_v3_push/#audience

private final DeviceClient deviceClient = new DeviceClient(PropKit.get("FLY_MASTER_SECRET"), PropKit.get("FLY_APP_KEY"),
			null, ClientConfig.getInstance());
      //添加标签
	public boolean addDevicesFromTag(String tag, Set<Set<String>> registrationId) {
		try {
	
			DefaultResult addRemoveDevicesFromTag = null;
			for (Set<String> set : registrationId) {
				addRemoveDevicesFromTag = deviceClient.addRemoveDevicesFromTag(tag, set, null);
			}
			
			return addRemoveDevicesFromTag.isResultOK();
		} catch (APIConnectionException | APIRequestException e) {
			e.printStackTrace();
		}
		return false;
	}

   //移除标签
public boolean removeDevicesFromTag(String tag, Set<Set<String>> registrationId) {
		try {
			DefaultResult addRemoveDevicesFromTag =null;
			for (Set<String> index : registrationId) {
				LOG.info("-------->移除标签:"+index.toString());
				addRemoveDevicesFromTag = deviceClient.addRemoveDevicesFromTag(tag, null, index);
				LOG.info("--------->移除标签结果"+addRemoveDevicesFromTag.toString());
			}
			return addRemoveDevicesFromTag.isResultOK();
		} catch (APIConnectionException | APIRequestException e) {
			e.printStackTrace();
		}
		return false;
	}

//移除标签的日志
[INFO]-[Thread: Timer-2]-[com.sakurakoineko.shinkuro.service.utils.jiguangPushUtils.removeDevicesFromTag()]: -------->移除标签:[18171adc03412739088, 170976fa8af36ed1d8a, 13165ffa4e784ac5b90, 121c83f7606ca2d4699, 1104a89792e4768955a, 1a1018970ae8f7cd7e0, 101d855909377a8cd7e, 1507bfd3f7b66e09c83, 161a3797c875cda5756, 171976fa8accd317b31, 1a1018970ad744e17c5, 1517bfd3f7b664afbdf, 191e35f7e034886beac, 121c83f7605441f172d, 1517bfd3f78af18c8e4, 171976fa8acc2857e32, 140fe1da9eeadeec928, 13165ffa4e79779d728, 191e35f7e00e97707db, 13165ffa4e7f6ac9c0b, 101d85590904bcee6a4, 1a1018970ae7392a872, 121c83f7606b773d963, 1114a89792e47508b78, 1a0018970ae9c452d27, 1114a89792d86de2319, 1507bfd3f79834dfe98, 1104a89792ebafbfb78, 101d85590904bff15b2, 1507bfd3f78de9b9cf2, 121c83f76056beb2813, 13165ffa4e7bb62d18d, 101d8559090b875bfb4, 13165ffa4e45e002e93]

2019-07-03 11:50:01
[INFO]-[Thread: Timer-2]-[com.xxxx.shinkuro.service.utils.jiguangPushUtils.removeDevicesFromTag()]: --------->移除标签结果{}

image

目前添加标签,成功后进行发送,发送成功后5分钟后再进行移除标签的,目前部分用户发送没能收到,并且移除了标签后这个在管理后台查询还是可以进行发送,并且发送成功

</dependency>
		<dependency>
			<groupId>cn.jpush.api</groupId>
			<artifactId>jpush-client</artifactId>
			<version>3.3.10-SNAPSHOT</version>
		</dependency>
		<dependency>
			<groupId>cn.jpush.api</groupId>
			<artifactId>jiguang-common</artifactId>
			<version>1.1.1</version>
		</dependency>

只要你标签下有一个目标设备,就能推送成功,不管是以前他设置了就卸载了还是怎样,可以选择完全删除 tag

收不到消息的提供 registrationID 和 MessageID给我查