public static void main(final String[] args) throws Exception { // New session factory final MessageSessionFactory sessionFactory = new MetaMessageSessionFactory(buildMetaClientConfig()); // subscribed topic final String topic = "meta-test-20"; // consumer group final String group = "meta-vintage-x-4"; // create consumer final MessageConsumer consumer = sessionFactory.createConsumer(new ConsumerConfig(group)); String[] types = {"type1", "type2"}; // subscribe topic consumer.subscribe( topic, 1024 * 1024, new MessageListener() { public void recieveMessages(final Message message) { System.out.println( "newId:" + message.getMsgNewId() + "\t attribute is:" + message.getAttribute()); } public Executor getExecutor() { return null; } }, types); // complete subscribe consumer.completeSubscribe(); }
public Tail(Config config, LogConfig logConfig, MessageSessionFactory sessionFactory) throws IOException { this.scanner = new Scanner(logConfig); this.sender = new Sender(logConfig, sessionFactory.createProducer(logConfig.ordered)); this.checkPoint = new CheckPoint(config, logConfig); this.config = config; this.logConfig = logConfig; }