{"id":358,"date":"2019-11-02T23:26:31","date_gmt":"2019-11-02T14:26:31","guid":{"rendered":"https:\/\/0x0c.info\/?p=358"},"modified":"2019-11-02T23:26:31","modified_gmt":"2019-11-02T14:26:31","slug":"%e3%80%90java%e3%80%91-kafkastreams-cleanup-%e3%81%8cstate-dir%e3%81%ae%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92%e3%81%86%e3%81%be%e3%81%8f%e6%b6%88%e3%81%9b%e3%81%aa%e3%81%8f%e3%81%a6%e3%82%a8","status":"publish","type":"post","link":"https:\/\/0x0c.info\/?p=358","title":{"rendered":"\u3010Java\u3011 kafkaStreams.cleanUp(); \u304cstate dir\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u3046\u307e\u304f\u6d88\u305b\u306a\u304f\u3066\u30a8\u30e9\u30fc\u306b\u306a\u308b\u5834\u5408"},"content":{"rendered":"<p>\t\t\t\t\u304a\u305d\u3089\u304fwindows\u74b0\u5883\u3060\u3051\u306e\u554f\u984c\u3067\u3059\u3002<\/p>\n<pre><code>        KafkaStreams kafkaStreams = new KafkaStreams(builder.build(), streamsConfiguration);\n        kafkaStreams.cleanUp();\n<\/code><\/pre>\n<p>\u306e\u524d\u306b<\/p>\n<pre><code>        final File baseDir = new File(streamsConfiguration.get(StreamsConfig.STATE_DIR_CONFIG).toString());\n        final File stateDir = new File(baseDir, streamsConfiguration.get(StreamsConfig.APPLICATION_ID_CONFIG).toString());\n        \/\/System.out.println(stateDir);\n        try {\n            FileUtils.deleteDirectory(stateDir);\n        } catch (IOException e) {\n            System.out.println(\"delete error\");\n        }\n<\/code><\/pre>\n<p>\u3092\u7a81\u3063\u8fbc\u307f\u307e\u3059\u3002<\/p>\n<p><code>import org.apache.commons.io.FileUtils;<\/code> \u306a\u3069\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u304a\u305d\u3089\u304fwindows\u74b0\u5883\u3060\u3051\u306e\u554f\u984c\u3067\u3059\u3002 KafkaStreams kafkaStreams = new KafkaStreams(builder.build(), streamsConfiguration); kafkaStreams.cleanUp(); \u306e\u524d\u306b final File baseDir = new File(streamsConfiguration.get(StreamsConfig.STATE_DIR_CONFIG).toString()); final File stateDir = new File(baseDir, streamsConfiguration.get(StreamsConfig.APPLICATION_ID_CONFIG).toString()); \/\/System.out.println(stateDir); try { FileUtils.deleteDirectory(stateDir); } catch (IOException e) { System.out.println(&#8220;delete error&#8221;); } \u3092\u7a81\u3063\u8fbc\u307f\u307e\u3059\u3002 import org.apache.commons.io.FileUtils; \u306a\u3069\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[38,42,80],"class_list":["post-358","post","type-post","status-publish","format-standard","hentry","category-java","tag-java","tag-kafka","tag-windows"],"_links":{"self":[{"href":"https:\/\/0x0c.info\/index.php?rest_route=\/wp\/v2\/posts\/358","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/0x0c.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/0x0c.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/0x0c.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/0x0c.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=358"}],"version-history":[{"count":0,"href":"https:\/\/0x0c.info\/index.php?rest_route=\/wp\/v2\/posts\/358\/revisions"}],"wp:attachment":[{"href":"https:\/\/0x0c.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/0x0c.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/0x0c.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}