在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:popout开源软件地址:https://gitee.com/mirrors/popout开源软件介绍:Popout
Don't forget to take a look at our benchmarks. ContentsRequirementsUsageAdd dependencyInclude the dependency to your project's pom.xml file: <dependencies> ... <dependency> <groupId>org.infobip.lib</groupId> <artifactId>popout</artifactId> <version>2.1.0</version> </dependency> ...</dependencies> or Gradle: compile 'org.infobip.lib:popout:2.1.0' Create a queueLet's create a minimal config FileQueue<String> queue = FileQueue.<String>synced().build(); The code above creates synced The differences between the
There are two main
More advanced Queue<Integer> queue = FileQueue.<Integer>batched() // the name of the queue, used in file patterns .name("popa") // the default folder for all queue's files .folder("/folder/where/store/queue/files") // sets custom serializer .serializer(Serializer.INTEGER) // sets custom deserializer .deserializer(Deserializer.INTEGER) // set up the queue's limits settings .limit(QueueLimit.queueLength() .length(1_000_000) .handler(myQueueLimitExceededHandler)) // restores from disk or not, during startup. If 'false' - the previous files will be removed .restoreFromDisk(false) // handler for corrupted data from disk .corruptionHandler(new MyCorruptionHandler()) // WAL files configuration .wal(WalFilesConfig.builder() // the place where WAL files stores. Default is a queue's folder above .folder("some/wal/files/folder") // the maximum allowed amount of WAL files before compression .maxCount(1000) .build()) // compressed files config .compressed(CompressedFilesConfig.builder() // the place where compressed files stores. Default is a queue's folder above .folder("some/compressed/files/folder") // the maximum allowed compressed file's size .maxSizeBytes(SizeUnit.MEGABYTES.toBytes(256)) .build()) // the amount of elements in one WAL file. only batched queue option .batchSize(10_000) .build(); Basic operationsAdd some data to the queue to the end of the queue. queue.add("popa"); Read data at the head of the queue (without removing it): String record = queue.peek(); In short, // Queue's sizeint queueSize = queue.size();// Add many itemsqueue.addAll(asList("one", "two", "three"));// Retrieves and removes the head of this queue,String head = queue.poll();// Remove all elements.queue.clear();// Use queue's iteratorIterator<String> iterator = queue.iterator(); Custom serialization and deserializationBy default, queue uses standard Java's serialization/deserialization mechanism, but you could override it by implementing Serializer and Deserializer: Queue<String> queue = FileQueue.<String>synced() .serializer(<your_serializaer_impl>) .deserializer(<your_deserializaer_impl>) .build(); DevelopmentThese instructions will get you a copy of the project up and running on your local machine for development and testing purposes. PrerequisitesFor building the project you need only a Java compiler.
And, of course, you need to clone Popout from GitHub: $> git clone https://github.com/infobip/popout$> cd popout BuildingFor building routine automation, I am using maven. To build the Popout project, do the following: $> mvn clean package...[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESS[INFO] ------------------------------------------------------------------------[INFO] Total time: 35.491 s[INFO] Finished at: 2019-01-18T23:25:12+03:00[INFO] Final Memory: 50M/548M[INFO] ------------------------------------------------------------------------ Running the testsTo run the project's test, do the following: $> mvn clean test...[INFO] -------------------------------------------------------[INFO] T E S T S[INFO] -------------------------------------------------------...[INFO][INFO] Results:[INFO][INFO] Tests run: 32, Failures: 0, Errors: 0, Skipped: 0[INFO]... Also, if you do Built With
ChangelogTo see what has changed in recent versions of Popout, see the changelog file. ContributingPlease read contributing file for details on my code of conduct, and the process for submitting pull requests to me. VersioningWe use SemVer for versioning. For the versions available, see the tags on this repository. Authors
LicenseThis project is licensed under the Apache License 2.0 License - see the license file for details |
请发表评论