I have read http://www.rabbitmq.com/firehose.html and managed to trace some messages into a queue. I was looking to find out the "delivery-mode" (Non-persistent (1) or persistent (2).) of the messages. However, I can't see it in the firehose notification format. Is it supposed to be there?
Example:
Properties
headers:
exchange_name: myresults
routing_keys:
properties:
headers:
x-received-from:
uri: amqp://obscured1.net/%2F
exchange: myresults
redelivered: false
cluster-name: rabbit#obscured2.net
node: rabbit#b7
vhost: /
connection: rabbit#b7.3.351.0
channel: 1
user: none
routed_queues: myresults-c-v2
Payload: {.............}
Delivery mode is one of the content properties (a.k.a. message properties, basic properties).
Related
I have registered receive endpoint in SingleActiveConsumer mode. However I can't find a way to send a message directly to queue by using sendEndpoint. I receive following error:
The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - inequivalent arg 'x-single-active-consumer' for queue 'test' in vhost '/': received none but current is the value 'true' of type 'bool'',
I tried setting header "x-single-active-consumer"=true by using bus configurer:
var bus = Bus.Factory.CreateUsingRabbitMq(cfg =>
{
cfg.Host("localhost", "/", h =>
{
h.Username("guest");
h.Password("guest");
});
cfg.ConfigureSend(a => a.UseSendExecute(c => c.Headers.Set("x-single-active-consumer", true)));
});
and directly on sendEndpoint:
await sendEndpoint.Send(msg, context => {
context.Headers.Set("x-single-active-consumer", true);
});
If you want to send directly to a receive endpoint in MassTransit, you can use the short address exchange:test instead, which will send to the exchange without trying to create/bind the queue to the exchange with the same name. That way, you decouple the queue configuration from the message producer.
Or, you could just use Publish, and let the exchange bindings route the message to the receive endpoint queue.
How to set 'x-message-ttl' properties to this queue?
rabbit:
bindings:
TEST_RESPONSE:
consumer:
bindingRoutingKey: "'${routing}'"
prefetch: ${prefetch}
acknowledge-mode: MANUAL
bindings:
TEST_RESPONSE:
destination: TEST_RESPONSE
content-type: application/json
group: test
because a have this error
Channel shutdown: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'x-message-ttl' for queue 'TEST_RESPONSE.test' in vhost '/': received none but current is the value '60000' of type 'long', class-id=50, method-id=10)
Queue definitions are immutable; you can't change a queue argument.
You either need to disable queue declaration
...rabbit.bindings.foo.consumer.bindQueue: false
or add
...rabbit.bindings.foo.consumer.ttl: 60000
to match the existing definition.
See consumer properties.
https://cloud.spring.io/spring-cloud-static/spring-cloud-stream-binder-rabbit/3.0.3.RELEASE/reference/html/spring-cloud-stream-binder-rabbit.html#_rabbitmq_consumer_properties
Yesterday, I found a problem that after successfully making a new subscription, there is no webhook posted to the specified URL while the RingOut call is in progress.
So far, when my app subscribes for the events (mentioned below), I see that the whole process go through just fine and my webhook endpoint always gets something back from RingCentral. However, after that, there is ZERO postback to that webhook endpoint so far.
The webhook endpoint is always accessible and operational without issue.
At the moment, I believe that there is no postback from RingCentral but I am not so sure about that.
I would like some guidance how to investigate this issue.
Steps to reproduce the problem:
Make a new subscription or ignore if there is an active webhook subscription for the following events:
/restapi/v1.0/account/~/extension/~/presence?detailedTelephonyState=true&sipData=true
/restapi/v1.0/account/~/extension/~/presence/line/presence?detailedTelephonyState=true
Make a RingOut call.
I discovered the same issue as I built out this sample app showing how Webhooks with RingCentral can operate: https://github.com/bdeanindy/ringcentral-webhook-basics
> ringcentral-webhook-basics#0.1.0 start /Users/benjamin.dean/MyApps/ringcentral-webhook-basics
> node index.js
PORT: 3000
Server is listening on port: 3000
LOGIN SUCCESS DATA: { access_token: 'HIDDEN',
token_type: 'bearer',
expires_in: 3600,
refresh_token: 'HIDDEN',
refresh_token_expires_in: 604800,
scope: 'ReadMessages Faxes ReadPresence ReadAccounts EditExtensions RingOut SMS InternalMessages ReadCallLog ReadCallRecording Accounts',
owner_id: 'HIDDEN',
endpoint_id: 'HIDDEN' }
BODY:
Subscription Response: { uri: 'https://platform.devtest.ringcentral.com/restapi/v1.0/subscription/HIDDEN',
id: 'HIDDEN',
creationTime: '2016-09-15T22:48:45.877Z',
status: 'Active',
eventFilters:
[ '/restapi/v1.0/account/133128004/extension/134694004/presence?detailedTelephonyState=true',
'/restapi/v1.0/account/133128004/extension/133128004/presence?detailedTelephonyState=true',
'/restapi/v1.0/account/133128004/extension/664573005/presence?detailedTelephonyState=true',
'/restapi/v1.0/account/133128004/extension/133165004/presence?detailedTelephonyState=true',
'/restapi/v1.0/account/133128004/extension/138323004/presence?detailedTelephonyState=true' ],
expirationTime: '2016-09-22T22:48:45.877Z',
expiresIn: 604799,
deliveryMode:
{ transportType: 'WebHook',
encryption: false,
address: 'http://fbe654d0.ngrok.io/webhooks?auth_token=HIDDEN' } }
Just made a call from soft phone to my mobile device (no events are arriving).
Now I am going to hangup the call and then I am going to change the availability status of the user to see if that generates events...
BODY: {"uuid":"88474bfa-061e-4184-9e39-3ca78e51e1be","event":"/restapi/v1.0/account/133128004/extension","timestamp":"2016-09-15T22:50:34.418Z","subscriptionId":"ad355889-74cc-4db1-9fd0-fc20f442c261","body":{"extensions":[{"extensionId":"133128004","eventType":"Update"}]}}
BODY: {"uuid":"bc236a49-e01b-4c3f-bb75-872745381a3b","event":"/restapi/v1.0/account/133128004/extension","timestamp":"2016-09-15T22:50:34.418Z","subscriptionId":"26ba88c0-0554-4ff7-8dfb-e1f597306176","body":{"extensions":[{"extensionId":"133128004","eventType":"Update"}]}}
BODY: {"uuid":"4efc4740-3b26-43a4-8c74-e984a778c364","event":"/restapi/v1.0/account/133128004/extension","timestamp":"2016-09-15T22:50:34.418Z","subscriptionId":"b2d76ced-b860-4fb9-af1d-aeb55cf2bf0f","body":{"extensions":[{"extensionId":"133128004","eventType":"Update"}]}}
BODY: {"uuid":"b3d53990-26ae-4241-8eac-0acfe210c6cb","event":"/restapi/v1.0/account/133128004/extension","timestamp":"2016-09-15T22:50:34.418Z","subscriptionId":"f22cec6d-3f0e-4a10-aa6b-e3a726fe8e61","body":{"extensions":[{"extensionId":"133128004","eventType":"Update"}]}}
BODY: {"uuid":"4a3aebe7-8fd7-411b-8cf6-6809be3491a1","event":"/restapi/v1.0/account/133128004/extension","timestamp":"2016-09-15T22:50:34.418Z","subscriptionId":"9dc0fbd3-b5dc-4b09-9dd1-db61098b6195","body":{"extensions":[{"extensionId":"133128004","eventType":"Update"}]}}
BODY: {"uuid":"54fe63e4-6cec-4da7-b91b-02066f2218d7","event":"/restapi/v1.0/account/133128004/extension","timestamp":"2016-09-15T22:50:37.431Z","subscriptionId":"ad355889-74cc-4db1-9fd0-fc20f442c261","body":{"extensions":[{"extensionId":"133128004","eventType":"Update"}]}}
BODY: {"uuid":"3abf1018-816b-48cd-a8b5-eb7c484f25bc","event":"/restapi/v1.0/account/133128004/extension","timestamp":"2016-09-15T22:50:37.431Z","subscriptionId":"26ba88c0-0554-4ff7-8dfb-e1f597306176","body":{"extensions":[{"extensionId":"133128004","eventType":"Update"}]}}
BODY: {"uuid":"70fba7c1-e820-408c-897f-387d23aad789","event":"/restapi/v1.0/account/133128004/extension","timestamp":"2016-09-15T22:50:37.431Z","subscriptionId":"f22cec6d-3f0e-4a10-aa6b-e3a726fe8e61","body":{"extensions":[{"extensionId":"133128004","eventType":"Update"}]}}
BODY: {"uuid":"20a4207e-9574-43ad-8246-afb2bb728853","event":"/restapi/v1.0/account/133128004/extension","timestamp":"2016-09-15T22:50:37.431Z","subscriptionId":"b2d76ced-b860-4fb9-af1d-aeb55cf2bf0f","body":{"extensions":[{"extensionId":"133128004","eventType":"Update"}]}}
BODY: {"uuid":"aa3d2e9f-dde5-4259-b14d-f105056784d1","event":"/restapi/v1.0/account/133128004/extension","timestamp":"2016-09-15T22:50:37.431Z","subscriptionId":"9dc0fbd3-b5dc-4b09-9dd1-db61098b6195","body":{"extensions":[{"extensionId":"133128004","eventType":"Update"}]}}
So we are not receiving any telephony events for VOIP, but we are receiving presence events for the extension.
Now, let's try sending an SMS and see if we receive any events.
Nope, no events for SMS either.
I found that no telephony related events were being POSTed to my webhook endpoint as expected, but the extension presence events (updates and modifications to availability) were generating events.
I have contacted our engineering team to investigate this issue and to help get it resolved.
Thank you for reporting this Janielle. I will update this post when it has been fixed.
The below code shows how I am setting header and message type to AMQP message.
MessageProperties properties = new MessageProperties();
properties.setHeader("KEY", "HOUSE");
properties.setContentType(MessageProperties.CONTENT_TYPE_JSON);
Message message = new Message("1234567;Branch A;SALES;3000.50;Pending approval".getBytes(), properties);
rabbitTemplate.sendAndReceive("", QUEUE_NAME, message);
After sending the message in the queue, the message is received by Transformer.
#Transformer(inputChannel = "inboundChannel", outputChannel = "toutboundChannel")
public Property buildProperty(Message<String> property){
LOGGER.info("message received :: HEADERS: {}, PAYLOAD :{}", property.getHeaders(), property.getPayload());
....
}
In the logs, the header "KEY: HOUSE" is missing and even the message type is not JSON and "text/plain" instead.
LOGS:
[SimpleAsyncTaskExecutor-1] INFO com.demo.maven.spring.integration.endpoint.TransformerRequestBuilder - message received :: HEADERS: {amqp_receivedRoutingKey=mobile.queue, amqp_deliveryTag=2, amqp_replyTo=amq.rabbitmq.reply-to.g2dkABByYWJiaXRAbG9jYWxob3N0AAAW9QAAAAAD.tTIFOS2gsM7qIlGYaybfrg==, amqp_deliveryMode=PERSISTENT, amqp_redelivered=true, id=399dda4f-4ba1-7cf4-2310-03dbfbac82b6, contentType=text/plain, timestamp=1421649922840}, PAYLOAD :1234567;Branch A;SALES;3000.50;Pending approval
MessagePropertiesBuilder class is for that.
By default Spring Integration AMQP Inbound Endpoint (AmqpInboundChannelAdapter and AmqpInboundGateway) maps only standard AMQP headers. That's is a default behaviour of DefaultAmqpHeaderMapper. To accept any user-specofic headers you should inject AmqpHeaderMapper (setHeaderMapper) to that inbound endpoint with an option setRequestHeaderNames("*"). Or provide full list of names of desired custom headers.
Re. contentType=text/plain: I think something between AMQP Inbound Endpoint and that #Transformer(inputChannel = "inboundChannel" overrides the received from AMQP contentType header. Because RabbitTemplate doesn't do that, if you send Message not any other Object. Please, share DEBUG logs for the org.springframework.integration category for the message receiver. Of course we need that part of logs, when you receive message till that #Transformer
This will work, you have to build the messageproperties correctly.
MessageProperties properties = new MessageProperties();
properties.builder()
.contentType(MediaType.APPLICATION_JSON)
//headers here
.headers(Map<String, Object>)
.build();
I've set up a text chat service using the PeerJS implementation of WebRTC's data channel. PeerJS provides a basic signalling server for this purpose, but I have tried to replace that with STUN and TURN servers set up through XirSys (recommended by SimpleWebRTC, another WebRTC library). I haven't deployed to the web yet.
Using Node to serve my static files locally, it will work on a local network (when I am sitting next to the person and they navigate to my ip/port in the browser), but will not work when connecting through different access points on the same network (i.e. at work, on opposite ends of the building).
My hypothesis is that it's hitting a firewall, but still directing traffic to PeerJS' signalling server without falling back to the XirSys STUN and TURN servers I've tried to set up. Here's the code I'm working with:
var stun = {};
var turn1 = {};
var turn2 = {};
$.ajax({
type: "POST",
dataType: "json",
url: "https://api.xirsys.com/getIceServers",
data: {
ident: "myusername",
secret: "long-alphanumeric-secret-key",
domain: "www.adomain.com",
application: "anapp",
room: "aroom",
secure: 1
},
success: function (data, status) {
console.log(data);
stun = data.d.iceServers[0];
turn1 = data.d.iceServers[1];
turn2 = data.d.iceServers[2];
},
async: false
});
var conn;
// Connect to PeerJS, have server assign an ID instead of providing one
var peerID = prompt('What would you like your screen name to be?');
var peer = new Peer(
peerID,
{key: 'mypeerjsserverkey', debug: true},
{
config: {'iceServers': [
{url: stun.url},
{url: turn1.url, credential: turn1.credential, username: turn1.username},
{url: turn2.url, credential: turn2.credential, username: turn2.username}
]
}
});
NOTE: My ident, secret, domain, etc. obviously aren't accurately represented here. I don't think that's where my problem is.
Any thoughts?
If you email us a wireshark capture of your STUN/TURN traffic, we should be able to outline where your problem is. Messages sent over signalling are separate but parallel to WebRTC messages. Therefore, if the app is working but the messages are being sent over signalling, then it's possible the configuration of the application isn't correct.
XirSys provides TURN via UDP over TCP through port 80/443, so if the signalling is connecting and flowing, so should the TURN.
Also, looking at your code, if you pass data.d from your getIceServers success handler to the PeerJS config, that should reduce your code quite a bit :-) The ICE string you're reconstructing doesn't need to be broken down.
Regards,
Lee
XirSys CTO