package com.foo;


/**
 * PubSub demo!
 *
 */
public class App {

    public static void main( String[] args ) {
        System.out.println("Welcome to PubSub!");
        demoSub();
    }

    public static void demoSub() {

    }

    public static void demoPub() {

    }
}

@@ -11,16 +11,370 @@
 m.foo;%0A%0A
+import com.wanda.pubsub.client.bean.HttpConfig;%0Aimport com.wanda.pubsub.client.bean.PubConfig;%0Aimport com.wanda.pubsub.client.bean.SubConfig;%0Aimport com.wanda.pubsub.client.bean.SubResult;%0Aimport com.wanda.pubsub.client.enums.StatusCodeEnum;%0Aimport com.wanda.pubsub.client.exception.AuthorityErrorException;%0Aimport com.wanda.pubsub.client.sub.SubClient;%0A
 %0A/**%0A * 
@@ -390,11 +390,8 @@
 mo!%0A
- *%0A
  */%0A
@@ -438,17 +438,16 @@
 id main(
- 
 String%5B%5D
@@ -451,17 +451,16 @@
 g%5B%5D args
- 
 ) %7B%0A    
@@ -509,68 +509,1152 @@
 %22);%0A
-        demoSub();%0A    %7D%0A%0A    public static void demoSub() %7B
+%0A        PubConfig pubConfig;%0A        SubConfig subConfig = new SubConfig(%22http://sub.foo.com/%22, %22app1%22, %22subkey%22);%0A        HttpConfig httpConfig = new HttpConfig();%0A%0A        demoSub(subConfig, httpConfig);%0A    %7D%0A%0A    public static void demoSub(SubConfig subConfig, HttpConfig httpConfig) %7B%0A        SubClient sbClient = new SubClient(subConfig, httpConfig);%0A        String offset = null;%0A        String patition = null;%0A%0A        while (true) %7B%0A            try %7B%0A                SubResult result = sbClient.pullAsack(offset, patition);%0A                int statusCode = result.getStatusCode();%0A                if (statusCode != StatusCodeEnum.RECEIVE_SUCCESS.getStatus()) %7B%0A                    try %7B%0A                        Thread.sleep(200);%0A                    %7D catch (InterruptedException e) %7B%0A                        e.printStackTrace();%0A                    %7D%0A                %7D%0A%0A                System.out.println(result);%0A%0A            %7D catch (AuthorityErrorException ae) %7B //%E9%9C%80%E8%A6%81%E7%BB%88%E6%AD%A2%E7%BA%BF%E7%A8%8B%0A                ae.printStackTrace();%0A                break;%0A            %7D catch (Exception e) %7B%0A                e.printStackTrace();%0A            %7D%0A        %7D
 %0A%0A  

introduce sub client