Skip to content

A java Producer/Multi-Consumer tool based on BlockingQueue.

Notifications You must be signed in to change notification settings

Zhizhaochen/XConsumer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

XConsumer

A java Producer/Multi-Consumer tool based on BlockingQueue.

Usage

public class Main {
	
	public static class IProducer extends Producer {
		@Override
		public void produce(URLFrontier frontier) {
			//Do something ...
		}
	}
	
	public static class IConsumer extends Consumer {
		@Override
		protected void consume(Consumer consumer, String curURL) {
			//Do something ...
		}
	}
	
	public static void main(String[] args) throws InstantiationException, IllegalAccessException {
		
		XConsumer xConsumer = new XConsumer.Builder()
			.setProduceClass(IProducer.class)
			.setConsumeClass(IConsumer.class)
			.setMaxItemsFrontierOnceFetch(30)
			.setNCrawlers(7)
			.build();
		xConsumer.start();
	}
}

About

A java Producer/Multi-Consumer tool based on BlockingQueue.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages