Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-using client through Drupal DependencyInjection causes null protocol #167

Open
whikloj opened this issue Apr 27, 2022 · 0 comments
Open

Comments

@whikloj
Copy link
Collaborator

whikloj commented Apr 27, 2022

We are using stomp-php with Drupal through the Islandora stack and have hit an issue.

When an attempt to send a message fails, it leaves the StatefulStomp client with an isConnecting state of true.

So if a second message is attempted using the same client we hit

Call to a member function getBeginFrame() on null in Stomp\States\ProducerTransactionState->initTransaction() (line 53 of vendor/stomp-php/stomp-php/src/States/TransactionsTrait.php).

This seems to be because the transaction trait chains getProtocol even though it could be null.

I'd suggest removing the check of isConnecting from the getProtocol function and only rely on isConnected before returning the protocol.
i.e.

public function getProtocol()
{
    if (!$this->isConnected()) {
        $this->connect();
    }
    return $this->protocol;
}

But if there is a good reason for leaving isConnecting in there, then perhaps some method to reset the isConnecting state (as it is a private variable)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant