github.com/asynkron/protoactor-go@v0.0.0-20240308120642-ef91a6abee75/actor/message.go (about)

     1  package actor
     2  
     3  // The Producer type is a function that creates a new actor
     4  type Producer func() Actor
     5  type ProducerWithActorSystem func(system *ActorSystem) Actor
     6  
     7  // Actor is the interface that defines the Receive method.
     8  //
     9  // Receive is sent messages to be processed from the mailbox associated with the instance of the actor
    10  type Actor interface {
    11  	Receive(c Context)
    12  }
    13  
    14  // The ReceiveFunc type is an adapter to allow the use of ordinary functions as actors to process messages
    15  type ReceiveFunc func(c Context)
    16  
    17  // Receive calls f(c)
    18  func (f ReceiveFunc) Receive(c Context) {
    19  	f(c)
    20  }
    21  
    22  type ReceiverFunc func(c ReceiverContext, envelope *MessageEnvelope)
    23  
    24  type SenderFunc func(c SenderContext, target *PID, envelope *MessageEnvelope)
    25  
    26  type ContextDecoratorFunc func(ctx Context) Context