FYI, after some testing it turns out that parallelizing user creation
works well, but that parallelizing email list creation and
modification does not work well.  It's possible workaround this with
error recovery logic, but it is more straightforward to execute email
list changes sequentially.

-alex

On Nov 7 2007, 9:10 am, tagama <[EMAIL PROTECTED]> wrote:
> I've already asked about batch creation of emaillists and inclusion of
> recipients on these emaillists...
>
> My problem is that a have to create 500 emailists and include, in
> average, 100 recipients in each one.
>
> As Alex(Google) said that batch operations are not supported and
> suggested me to use multithreading instead, I starded develop using
> this approach. The problem is that I can't make this work. Does Google
> block multiple request from the same IP? To clarify, I'm posting my
> code above.
>
> public List<EmailListRecipientEntry> addRecipientsToEmailList(
>                         List<String> recipientAddresses, String emailList, 
> String
> domainName)
>                         throws AppsForYourDomainException, ServiceException, 
> IOException {
>                 List<EmailListRecipientEntry> recipientEntrys = new
> ArrayList<EmailListRecipientEntry>();
>
>                 prepareEmailListRecipientService(domainName);
>                 emailList = emailList.toLowerCase();
>
>                 ExecutorService executor = Executors.newFixedThreadPool(10);
>
>                 for (String address : recipientAddresses) {
>                         LOGGER.log(Level.INFO, "Adding '" + address + "' to 
> emailList '"
>                                         + emailList + "'.");
>                         EmailListRecipientEntry emailListRecipientEntry = new
> EmailListRecipientEntry();
>                         Who who = new Who();
>                         who.setEmail(address.toLowerCase());
>                         emailListRecipientEntry.addExtension(who);
>                         URL insertUrl = new URL(domainUrlBase + "emailList/"
>                                         + SERVICE_VERSION + "/" + emailList + 
> "/recipient");
>
>                         executor.submit(new
> MyThread<EmailListRecipientEntry>(emailListRecipientService,insertUrl,emailListRecipientEntry
>  ));
>
>                 }
>
>                 return recipientEntrys;
>         }
>
> class MyThread<E extends BaseEntry<E>> implements
> Callable<BaseEntry<E>> {
>                 private GoogleService service;
>                 private URL feedURL;
>                 private E entry;
>
>                 MyThread(GoogleService service, URL feedURL, E entry) {
>                         this.service = service;
>                         this.feedURL = feedURL;
>                         this.entry = entry;
>                 }
>
>                 public BaseEntry<E> call() {
>                         try {
>                                 return service.insert(feedURL, entry);
>                         } catch (AppsForYourDomainException e) {
>                                 System.out.println(e.getErrorCode());
>                         } catch (IOException e) {
>                                 e.printStackTrace();
>                         } catch (ServiceException e) {
>                                 e.printStackTrace();
>                         }
>                         return null;
>
>                 }
>
>         }
>
> Please, could someone help me?? It's blocking our progress...
> Thanks a lot!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Apps APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-apps-apis?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to