<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Nifi DistributedMapCacheClient keySet unsupportedOperationException in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Nifi-DistributedMapCacheClient-keySet/m-p/269731#M207051</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I'm trying to get all entries from a redis cache. When i try to remove, getbykey etc that work but when i call myCache.keySet, i face an issue with following exception: UnsupportedOperationEception on null.&lt;/P&gt;
&lt;P&gt;I check it in git source repo and keySet method is implemented. May be there is a mistake in my deserializer ? I would like to know the point of view of Nifi community .&lt;/P&gt;
&lt;P&gt;I'm currently stuck as i need to list all entries that are in redis in order to split them in other processor for a specific action in Nifi context.&lt;/P&gt;
&lt;P&gt;BElow some piece of code :&lt;/P&gt;
&lt;P&gt;- The deserializer&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="java"&gt;public static class StringDeserializer implements Deserializer&amp;lt;String&amp;gt;{

		@Override
		public String deserialize(byte[] input) throws DeserializationException, IOException {
			if (input == null || input.length == 0) {
                return null;
            }
            return input.toString();
		}
    }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;and piece of code of my custom processor code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;final DistributedMapCacheClient cache = context.getProperty(PROP_DISTRIBUTED_CACHE_SERVICE)
        		.asControllerService( DistributedMapCacheClient.class);
        
        // get all entry in cache
        try {
			Set&amp;lt;String&amp;gt; entries = cache.keySet(keyDeSerializer); // &amp;lt;== HERE CODE GENERATE ERROR
			logger.info("size ===&amp;gt; " + entries.size());
			entries.forEach(e-&amp;gt;{
				logger.info( "********************* " + e.toString());
				
			});
			session.transfer(flowFile, REL_SUCCESS);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			session.transfer(flowFile, REL_FAILURE);
		}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;and to finish the stacktrace:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;- failed to process session due to java.lang.UnsupportedOperationException;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;- java.lang.UnsupportedOperationException: null&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at org.apache.nifi.distributed.cache.client.DistributedMapCacheClient.keySet(DistributedMapCacheClient.java:221)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at java.lang.reflect.Method.invoke(Method.java:498)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at org.apache.nifi.controller.service.StandardControllerServiceInvocationHandler.invoke(StandardControllerServiceInvocationHandler.java:87)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at com.sun.proxy.$Proxy99.keySet(Unknown Source)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at com.**********.****.*****.processors.getRedisCache.FetchCacheWithoutInput.onTrigger(FetchCacheWithoutInput.java:121)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1162)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:209)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at java.lang.Thread.run(Thread.java:748)&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Sep 2019 15:52:36 GMT</pubDate>
    <dc:creator>badman</dc:creator>
    <dc:date>2019-09-04T15:52:36Z</dc:date>
    <item>
      <title>Nifi DistributedMapCacheClient keySet unsupportedOperationException</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-DistributedMapCacheClient-keySet/m-p/269731#M207051</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I'm trying to get all entries from a redis cache. When i try to remove, getbykey etc that work but when i call myCache.keySet, i face an issue with following exception: UnsupportedOperationEception on null.&lt;/P&gt;
&lt;P&gt;I check it in git source repo and keySet method is implemented. May be there is a mistake in my deserializer ? I would like to know the point of view of Nifi community .&lt;/P&gt;
&lt;P&gt;I'm currently stuck as i need to list all entries that are in redis in order to split them in other processor for a specific action in Nifi context.&lt;/P&gt;
&lt;P&gt;BElow some piece of code :&lt;/P&gt;
&lt;P&gt;- The deserializer&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="java"&gt;public static class StringDeserializer implements Deserializer&amp;lt;String&amp;gt;{

		@Override
		public String deserialize(byte[] input) throws DeserializationException, IOException {
			if (input == null || input.length == 0) {
                return null;
            }
            return input.toString();
		}
    }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;and piece of code of my custom processor code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;final DistributedMapCacheClient cache = context.getProperty(PROP_DISTRIBUTED_CACHE_SERVICE)
        		.asControllerService( DistributedMapCacheClient.class);
        
        // get all entry in cache
        try {
			Set&amp;lt;String&amp;gt; entries = cache.keySet(keyDeSerializer); // &amp;lt;== HERE CODE GENERATE ERROR
			logger.info("size ===&amp;gt; " + entries.size());
			entries.forEach(e-&amp;gt;{
				logger.info( "********************* " + e.toString());
				
			});
			session.transfer(flowFile, REL_SUCCESS);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			session.transfer(flowFile, REL_FAILURE);
		}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;and to finish the stacktrace:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;- failed to process session due to java.lang.UnsupportedOperationException;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;- java.lang.UnsupportedOperationException: null&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at org.apache.nifi.distributed.cache.client.DistributedMapCacheClient.keySet(DistributedMapCacheClient.java:221)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at java.lang.reflect.Method.invoke(Method.java:498)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at org.apache.nifi.controller.service.StandardControllerServiceInvocationHandler.invoke(StandardControllerServiceInvocationHandler.java:87)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at com.sun.proxy.$Proxy99.keySet(Unknown Source)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at com.**********.****.*****.processors.getRedisCache.FetchCacheWithoutInput.onTrigger(FetchCacheWithoutInput.java:121)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1162)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:209)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;at java.lang.Thread.run(Thread.java:748)&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 15:52:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-DistributedMapCacheClient-keySet/m-p/269731#M207051</guid>
      <dc:creator>badman</dc:creator>
      <dc:date>2019-09-04T15:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi DistributedMapCacheClient keySet unsupportedOperationException</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-DistributedMapCacheClient-keySet/m-p/269739#M207057</link>
      <description>&lt;P&gt;After discussing in Nifi slack, keySet is not implemented in Redis DMCC ... So what is the good way to have it ASAP in order to get all entries in Redis db ? any suggestions .? thanks by advance ....&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 17:32:11 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-DistributedMapCacheClient-keySet/m-p/269739#M207057</guid>
      <dc:creator>badman</dc:creator>
      <dc:date>2019-09-04T17:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi DistributedMapCacheClient keySet unsupportedOperationException</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-DistributedMapCacheClient-keySet/m-p/270286#M207400</link>
      <description>&lt;P&gt;An issue was created&amp;nbsp; in jira to implement the missing method that was not implemented but declared in Interface. In the meantime, i created a custom processor that use Jedis dependency in order to fetch all entries.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 08:41:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-DistributedMapCacheClient-keySet/m-p/270286#M207400</guid>
      <dc:creator>badman</dc:creator>
      <dc:date>2019-09-12T08:41:38Z</dc:date>
    </item>
  </channel>
</rss>

