-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Supports max_frame_size of 4k (current limitation of <a href="https://github.com/Azure/qpid-proton-j-extensions">qpid-proton-j-extensions</a> library) 2. doesn't support PROXY on websockets - this will follow. Amqp over WebSockets is particularly used when enterprise policies (ex: firewall outbound port rules) doesn't allow traffic on the default Amqp secure port (`5671`). To send or receive over websockets - which uses port `443`, set the `TransportType` on `ConnectionStringBuilder`, like this: ``` connectionStringBuilder.setTransportType(TransportType.AmqpWebSockets) ``` related: #264
- Loading branch information
1 parent
8a901ab
commit 42d7363
Showing
25 changed files
with
389 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/TransportType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (c) Microsoft. All rights reserved. | ||
* Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
*/ | ||
package com.microsoft.azure.eventhubs; | ||
|
||
/** | ||
* All TransportType switches available for communicating to EventHubs service. | ||
*/ | ||
public enum TransportType { | ||
/** | ||
* AMQP over TCP. Uses port 5671 - assigned by IANA for secure AMQP (AMQPS). | ||
*/ | ||
AMQP("Amqp"), | ||
|
||
/** | ||
* AMQP over Web Sockets. Uses port 443. | ||
*/ | ||
AMQP_WEB_SOCKETS("AmqpWebSockets"); | ||
|
||
private final String value; | ||
|
||
TransportType(final String value) { | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return this.value; | ||
} | ||
|
||
static TransportType fromString(final String value) { | ||
for (TransportType transportType : values()) { | ||
if (transportType.value.equalsIgnoreCase(value)) { | ||
return transportType; | ||
} | ||
} | ||
|
||
throw new IllegalArgumentException(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...venthubs/src/main/java/com/microsoft/azure/eventhubs/impl/WebSocketConnectionHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) Microsoft. All rights reserved. | ||
* Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
*/ | ||
package com.microsoft.azure.eventhubs.impl; | ||
|
||
import com.microsoft.azure.proton.transport.ws.impl.WebSocketImpl; | ||
import org.apache.qpid.proton.engine.Event; | ||
import org.apache.qpid.proton.engine.impl.TransportInternal; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class WebSocketConnectionHandler extends ConnectionHandler { | ||
private static final Logger TRACE_LOGGER = LoggerFactory.getLogger(ConnectionHandler.class); | ||
|
||
public WebSocketConnectionHandler(AmqpConnection messagingFactory) { | ||
super(messagingFactory); | ||
} | ||
|
||
@Override | ||
protected void addTransportLayers(final Event event, final TransportInternal transport) { | ||
final WebSocketImpl webSocket = new WebSocketImpl(); | ||
webSocket.configure( | ||
event.getConnection().getHostname(), | ||
"/$servicebus/websocket", | ||
null, | ||
0, | ||
"AMQPWSB10", | ||
null, | ||
null); | ||
|
||
transport.addTransportLayer(webSocket); | ||
|
||
if (TRACE_LOGGER.isInfoEnabled()) { | ||
TRACE_LOGGER.info("addWebsocketHandshake: hostname[" + event.getConnection().getHostname() +"]"); | ||
} | ||
} | ||
|
||
@Override | ||
protected int getPort() { | ||
return ClientConstants.HTTPS_PORT; | ||
} | ||
|
||
@Override | ||
protected int getMaxFrameSize() { | ||
// This is the current limitation of https://github.com/Azure/qpid-proton-j-extensions | ||
// once, this library enables larger frames - this property can be removed. | ||
return 4 * 1024; | ||
} | ||
} |
Oops, something went wrong.