Problem/Motivation

the implementation of createChannel will log an error if the channel already exists. On the other hand there is no way using the NotificationServerClientInterface to check if a channel exists. It would be great to have a way to lazily create a channel w/o error-message or at least a way to check if a channel exists.

Comments

stmh created an issue. See original summary.

  • d34dman committed 7fa25ee1 on 1.x
    [#3555289] feat: create channel
    
    By: stmh
    By: d34dman
    
d34dman’s picture

Status: Active » Needs review

Now you can use these methods to avoid error logging:

// Option 1: Check first, then create if needed
if (!$client->channelExists('my-channel')) {
    $channelDTO = new ChannelDTO('my-channel');
    $client->createChannel($channelDTO);
}

// Option 2: Use the lazy creation method (recommended)
$channelDTO = new ChannelDTO('my-channel');
$success = $client->ensureChannel($channelDTO);
stmh’s picture

Status: Needs review » Reviewed & tested by the community

thank you. Seems to work!

d34dman’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.