Programmer Reference : Redis : EsRedisPushMessage
EsRedisPushMessage
Description
A data object that represents a single message received from a Redis Pub/Sub subscription. This object normalizes the different message formats from RESP2 (which uses simple arrays) and RESP3 (which uses PUSH types) into a consistent Smalltalk object.
An instance of me is created by the <EsRedisPubSubClient>'s listener process and is delivered to the user through the <EsStream> provided by an <EsRedisSubscription>.
Public API and Key Responsibilities
  • Providing accessors for the message type, channel, pattern (if any), and payload.
Usage Example
subscription stream listen: [:message |
message type = 'pmessage' ifTrue: [
Transcript show: 'Matched pattern: ' , message pattern.
].
Transcript show: 'Channel: ' , message channel.
Transcript show: 'Payload: ' , message payload.
].
Instance Variables
  • type - <String> The type of message, typically 'message' or 'pmessage'.
  • channel - <String> The name of the channel the message was published to.
  • pattern - <String | nil> For pattern subscriptions, the pattern that matched the channel.
  • payload - <String | ByteArray> The actual content of the message.
Class Methods
None
Instance Methods
channel
  Answers the channel the message was published on.
    
     Answers:
        <String>
channel:
  Sets the channel the message was published on.
    
     Arguments:
        anObject - <String>
pattern
  Answers the pattern that matched this message, if this was from a PSUBSCRIBE. Otherwise nil.
    
     Answers:
        <String | nil>
pattern:
  Sets the pattern that matched this message.
    
     Arguments:
        anObject - <String>
payload
  Answers the payload of the message.
    
     Answers:
        <String | ByteArray>
payload:
  Sets the payload of the message.
    
     Arguments:
        anObject - <String | ByteArray>
type
  Answers the type of the push message (e.g., 'message', 'pmessage').
    
     Answers:
        <String>
type:
  Sets the type of the push message.
    
     Arguments:
        anObject - <String>
Last modified date: 01/22/2026