Skip to content

Commit 9d2496f

Browse files
committed
[transport] Add Psr prefix to transport interfaces. Depreacted ones without it.
1 parent 88a8291 commit 9d2496f

18 files changed

+434
-344
lines changed

pkg/psr-queue/ConnectionFactory.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
namespace Enqueue\Psr;
44

5-
interface ConnectionFactory
5+
/**
6+
* @deprecated use PsrConnectionFactory
7+
*/
8+
interface ConnectionFactory extends PsrConnectionFactory
69
{
7-
/**
8-
* @return Context
9-
*/
10-
public function createContext();
1110
}

pkg/psr-queue/Consumer.php

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,8 @@
33
namespace Enqueue\Psr;
44

55
/**
6-
* A client uses a MessageConsumer object to receive messages from a destination.
7-
* A MessageConsumer object is created by passing a Destination object
8-
* to a message-consumer creation method supplied by a session.
9-
*
10-
* @see https://docs.oracle.com/javaee/7/api/javax/jms/MessageConsumer.html
6+
* @deprecated use PsrConsumer
117
*/
12-
interface Consumer
8+
interface Consumer extends PsrConsumer
139
{
14-
/**
15-
* Gets the Queue associated with this queue receiver.
16-
*
17-
* @return Queue
18-
*/
19-
public function getQueue();
20-
21-
/**
22-
* Receives the next message that arrives within the specified timeout interval.
23-
* This call blocks until a message arrives, the timeout expires, or this message consumer is closed.
24-
* A timeout of zero never expires, and the call blocks indefinitely.
25-
*
26-
* @param int $timeout the timeout value (in milliseconds)
27-
*
28-
* @return Message|null
29-
*/
30-
public function receive($timeout = 0);
31-
32-
/**
33-
* Receives the next message if one is immediately available.
34-
*
35-
* @return Message|null
36-
*/
37-
public function receiveNoWait();
38-
39-
/**
40-
* Tell the MQ broker that the message was processed successfully.
41-
*
42-
* @param Message $message
43-
*/
44-
public function acknowledge(Message $message);
45-
46-
/**
47-
* Tell the MQ broker that the message was rejected.
48-
*
49-
* @param Message $message
50-
* @param bool $requeue
51-
*/
52-
public function reject(Message $message, $requeue = false);
5310
}

pkg/psr-queue/Context.php

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,9 @@
22

33
namespace Enqueue\Psr;
44

5-
interface Context
5+
/**
6+
* @deprecated use PsrContext
7+
*/
8+
interface Context extends PsrContext
69
{
7-
/**
8-
* @param string $body
9-
* @param array $properties
10-
* @param array $headers
11-
*
12-
* @return Message
13-
*/
14-
public function createMessage($body = '', array $properties = [], array $headers = []);
15-
16-
/**
17-
* @param string $topicName
18-
*
19-
* @return Topic
20-
*/
21-
public function createTopic($topicName);
22-
23-
/**
24-
* @param string $queueName
25-
*
26-
* @return Queue
27-
*/
28-
public function createQueue($queueName);
29-
30-
/**
31-
* Create temporary queue.
32-
* The queue is visible by this connection only.
33-
* It will be deleted once the connection is closed.
34-
*
35-
* @return Queue
36-
*/
37-
public function createTemporaryQueue();
38-
39-
/**
40-
* @return Producer
41-
*/
42-
public function createProducer();
43-
44-
/**
45-
* @param Destination $destination
46-
*
47-
* @return Consumer
48-
*/
49-
public function createConsumer(Destination $destination);
50-
51-
public function close();
5210
}

pkg/psr-queue/Destination.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,8 @@
33
namespace Enqueue\Psr;
44

55
/**
6-
* A Destination object encapsulates a provider-specific address.
7-
* The transport API does not define a standard address syntax.
8-
* Although a standard address syntax was considered,
9-
* it was decided that the differences in address semantics between existing message-oriented middleware (MOM)
10-
* products were too wide to bridge with a single syntax.
11-
*
12-
* Since Destination is an administered object,
13-
* it may contain provider-specific configuration information in addition to its address.
14-
*
15-
* @see https://docs.oracle.com/javaee/7/api/javax/jms/Destination.html
6+
* @deprecated use PsrDestination
167
*/
17-
interface Destination
8+
interface Destination extends PsrDestination
189
{
1910
}

pkg/psr-queue/Message.php

Lines changed: 2 additions & 170 deletions
Original file line numberDiff line numberDiff line change
@@ -3,176 +3,8 @@
33
namespace Enqueue\Psr;
44

55
/**
6-
* The Message interface is the root interface of all transport messages.
7-
* Most message-oriented middleware (MOM) products
8-
* treat messages as lightweight entities that consist of a header and a payload.
9-
* The header contains fields used for message routing and identification;
10-
* the payload contains the application data being sent.
11-
*
12-
* Within this general form, the definition of a message varies significantly across products.
13-
*
14-
* @see https://docs.oracle.com/javaee/7/api/javax/jms/Message.html
6+
* @deprecated use PsrMessage
157
*/
16-
interface Message
8+
interface Message extends PsrMessage
179
{
18-
/**
19-
* @return string
20-
*/
21-
public function getBody();
22-
23-
/**
24-
* @param string $body
25-
*/
26-
public function setBody($body);
27-
28-
/**
29-
* @param array $properties
30-
*/
31-
public function setProperties(array $properties);
32-
33-
/**
34-
* @return array [name => value, ...]
35-
*/
36-
public function getProperties();
37-
38-
/**
39-
* @param string $name
40-
* @param mixed $value
41-
*/
42-
public function setProperty($name, $value);
43-
44-
/**
45-
* @param string $name
46-
* @param mixed $default
47-
*
48-
* @return mixed
49-
*/
50-
public function getProperty($name, $default = null);
51-
52-
/**
53-
* @param array $headers
54-
*/
55-
public function setHeaders(array $headers);
56-
57-
/**
58-
* @return array [name => value, ...]
59-
*/
60-
public function getHeaders();
61-
62-
/**
63-
* @param string $name
64-
* @param mixed $value
65-
*/
66-
public function setHeader($name, $value);
67-
68-
/**
69-
* @param string $name
70-
* @param mixed $default
71-
*
72-
* @return mixed
73-
*/
74-
public function getHeader($name, $default = null);
75-
76-
/**
77-
* @param bool $redelivered
78-
*/
79-
public function setRedelivered($redelivered);
80-
81-
/**
82-
* Gets an indication of whether this message is being redelivered.
83-
* The message is considered as redelivered,
84-
* when it was sent by a broker to consumer but consumer does not ACK or REJECT it.
85-
* The broker brings the message back to the queue and mark it as redelivered.
86-
*
87-
* @return bool
88-
*/
89-
public function isRedelivered();
90-
91-
/**
92-
* Sets the correlation ID for the message.
93-
* A client can use the correlation header field to link one message with another.
94-
* A typical use is to link a response message with its request message.
95-
*
96-
* @param string $correlationId the message ID of a message being referred to
97-
*
98-
* @throws Exception if the provider fails to set the correlation ID due to some internal error
99-
*/
100-
public function setCorrelationId($correlationId);
101-
102-
/**
103-
* Gets the correlation ID for the message.
104-
* This method is used to return correlation ID values that are either provider-specific message IDs
105-
* or application-specific String values.
106-
*
107-
* @throws Exception if the provider fails to get the correlation ID due to some internal error
108-
*
109-
* @return string
110-
*/
111-
public function getCorrelationId();
112-
113-
/**
114-
* Sets the message ID.
115-
* Providers set this field when a message is sent.
116-
* This method can be used to change the value for a message that has been received.
117-
*
118-
* @param string $messageId the ID of the message
119-
*
120-
* @throws Exception if the provider fails to set the message ID due to some internal error
121-
*/
122-
public function setMessageId($messageId);
123-
124-
/**
125-
* Gets the message Id.
126-
* The MessageId header field contains a value that uniquely identifies each message sent by a provider.
127-
*
128-
* When a message is sent, MessageId can be ignored.
129-
*
130-
* @throws Exception if the provider fails to get the message ID due to some internal error
131-
*
132-
* @return string
133-
*/
134-
public function getMessageId();
135-
136-
/**
137-
* Gets the message timestamp.
138-
* The timestamp header field contains the time a message was handed off to a provider to be sent.
139-
* It is not the time the message was actually transmitted,
140-
* because the actual send may occur later due to transactions or other client-side queueing of messages.
141-
*
142-
* @return int
143-
*/
144-
public function getTimestamp();
145-
146-
/**
147-
* Sets the message timestamp.
148-
* Providers set this field when a message is sent.
149-
* This method can be used to change the value for a message that has been received.
150-
*
151-
* @param int $timestamp
152-
*
153-
* @throws Exception if the provider fails to set the timestamp due to some internal error
154-
*/
155-
public function setTimestamp($timestamp);
156-
157-
/**
158-
* Sets the destination to which a reply to this message should be sent.
159-
* The ReplyTo header field contains the destination where a reply to the current message should be sent. If it is null, no reply is expected.
160-
* The destination may be a Queue only. A topic is not supported at the moment.
161-
* Messages sent with a null ReplyTo value may be a notification of some event, or they may just be some data the sender thinks is of interest.
162-
* Messages with a ReplyTo value typically expect a response.
163-
* A response is optional; it is up to the client to decide. These messages are called requests.
164-
* A message sent in response to a request is called a reply.
165-
* In some cases a client may wish to match a request it sent earlier with a reply it has just received.
166-
* The client can use the CorrelationID header field for this purpose.
167-
*
168-
* @param string|null $replyTo
169-
*/
170-
public function setReplyTo($replyTo);
171-
172-
/**
173-
* Gets the destination to which a reply to this message should be sent.
174-
*
175-
* @return string|null
176-
*/
177-
public function getReplyTo();
17810
}

pkg/psr-queue/Processor.php

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,9 @@
22

33
namespace Enqueue\Psr;
44

5-
interface Processor
5+
/**
6+
* @deprecated use PsrProcessor
7+
*/
8+
interface Processor extends PsrProcessor
69
{
7-
/**
8-
* Use this constant when the message is processed successfully and the message could be removed from the queue.
9-
*/
10-
const ACK = 'enqueue.ack';
11-
12-
/**
13-
* Use this constant when the message is not valid or could not be processed
14-
* The message is removed from the queue.
15-
*/
16-
const REJECT = 'enqueue.reject';
17-
18-
/**
19-
* Use this constant when the message is not valid or could not be processed right now but we can try again later
20-
* The original message is removed from the queue but a copy is publsihed to the queue again.
21-
*/
22-
const REQUEUE = 'enqueue.requeue';
23-
24-
/**
25-
* The method has to return either self::ACK, self::REJECT, self::REQUEUE string.
26-
*
27-
* The method also can return an object.
28-
* It must implement __toString method and the method must return one of the constants from above.
29-
*
30-
* @param Message $message
31-
* @param Context $context
32-
*
33-
* @return string|object
34-
*/
35-
public function process(Message $message, Context $context);
3610
}

pkg/psr-queue/Producer.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,9 @@
22

33
namespace Enqueue\Psr;
44

5-
interface Producer
5+
/**
6+
* @deprecated use PsrProducer
7+
*/
8+
interface Producer extends PsrProducer
69
{
7-
/**
8-
* @param Destination $destination
9-
* @param Message $message
10-
*
11-
* @throws Exception - if the provider fails to send
12-
* the message due to some internal error
13-
* @throws InvalidDestinationException - if a client uses
14-
* this method with an invalid destination
15-
* @throws InvalidMessageException - if an invalid message
16-
* is specified
17-
*/
18-
public function send(Destination $destination, Message $message);
1910
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Enqueue\Psr;
4+
5+
interface PsrConnectionFactory
6+
{
7+
/**
8+
* @return Context
9+
*/
10+
public function createContext();
11+
}

0 commit comments

Comments
 (0)