Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8800063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:29:17+00:00 2026-06-14T00:29:17+00:00

It is in AKKA documentation written that … Actors should not block (i.e. passively

  • 0

It is in AKKA documentation written that

… Actors should not block (i.e. passively wait while occupying a Thread) on some external entity, which might be a lock, a network socket, etc. The blocking operations should be done in some special-cased thread which sends messages to the actors which shall act on them.
source http://doc.akka.io/docs/akka/2.0/general/actor-systems.html#Actor_Best_Practices

I have found the following information at the moment :

  1. I read Sending outbound HTTP request from Akka / Scala and checked the example at https://github.com/dsciamma/fbgl1

  2. I found following article http://nurkiewicz.blogspot.de/2012/11/non-blocking-io-discovering-akka.html explaining how to use https://github.com/AsyncHttpClient/async-http-client non blocking http client with akka. But is written in Scala.

How can i write an actor that make non-blocking http requests?

It must downlad a remote url page as file and than send the generated file object to the master actor. master actor then sends this request to parser actor to parse the file…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T00:29:19+00:00Added an answer on June 14, 2026 at 12:29 am

    I have implemented this in this way.

    public class ReduceActor extends UntypedActor {
    @Override
    public void onReceive(Object message) throws Exception {
        if (message instanceof URI) {
            URI url = (URI) message;
    
            AsyncHttpClient asyncHttpClient = new AsyncHttpClient();
    
            asyncHttpClient.prepareGet(url.toURL().toString()).execute(new AsyncCompletionHandler<Response>() {
    
                @Override
                public Response onCompleted(Response response) throws Exception {
                    File f = new File("e:/tmp/crawler/" + UUID.randomUUID().toString() + ".html");
                    // Do something with the Response
                    // ...
                    // System.out.println(response1.getStatusLine());
                    FileOutputStream fao = new FileOutputStream(f);
                    IOUtils.copy(response.getResponseBodyAsStream(), fao);
                    System.out.println("File downloaded " + f);
                    getSender().tell(new WordCount(f));
                    return response;
                }
    
                @Override
                public void onThrowable(Throwable t) {
                    // Something wrong happened.
                }
            });
        } else
            unhandled(message);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've read akka documentation and can't produce clean understanding of thread interaction while using
So I've been playing with Akka Actors for a while now, and have written
I am writing a distributed application in Scala that uses Akka actors. I have
I have a Scala application using Akka that receives REST requests, makes some operations
Need some advice of how to use EventBus provided by Akka in Java (not
Having a simple Akka HTTP server: package org.package.some import akka.actor.{IOManager, IO, Actor} import java.net.InetSocketAddress
In the akka docs they specify that a message must be immutable an reference
I am working on a load generator app using akka actors. The app worked
import actors.Actor import akka.actor.Actor._ class HelloWorldActor extends Actor { def receive = { case
I have tried to read the Akka documentation to find out the exact difference

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.